/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */
package wherehows.models.view;
import lombok.Getter;
import lombok.AllArgsConstructor;

@Getter
@AllArgsConstructor
public class DatasetValidation {

  private String tier;

  private float score;

  private String description;

  private float weight;

  private String validator;
}

/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */
package wherehows.models.view;
import lombok.Getter;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DatasetValidation {

  private String tier;

  private float score;

  private String description;

  private float weight;

  private String validator;
}

Add noargsconstructor to datasetvalidation class


package net.engin33r.luaspigot.lua.lib;

import net.engin33r.luaspigot.lua.Library;
import net.engin33r.luaspigot.lua.annotation.LibFunctionDef;
import net.engin33r.luaspigot.lua.type.LuaPlayer;
import org.bukkit.Bukkit;
import org.luaj.vm2.Varargs;

/**
 * Library for interacting with players on and off the server.
 * Mostly deals with creating {@link LuaPlayer} instances.
 * @see LuaPlayer
 */
@SuppressWarnings("unused")
public class PlayerLibrary extends Library {
    @Override
    public String getName() {
        return "player";
    }

    @LibFunctionDef(name = "getByName")
    public Varargs getByName(Varargs args) {
        return new LuaPlayer(Bukkit.getOfflinePlayer(args.checkjstring(1)));
    }
}

package net.engin33r.luaspigot.lua.lib;

import net.engin33r.luaspigot.lua.Library;
import net.engin33r.luaspigot.lua.annotation.LibFunctionDef;
import net.engin33r.luaspigot.lua.type.LuaPlayer;
import net.engin33r.luaspigot.lua.type.LuaUUID;
import org.bukkit.Bukkit;
import org.luaj.vm2.Varargs;

/**
 * Library for interacting with players on and off the server.
 * Mostly deals with creating {@link LuaPlayer} instances.
 * @see LuaPlayer
 */
@SuppressWarnings("unused")
public class PlayerLibrary extends Library {
    @Override
    public String getName() {
        return "player";
    }

    @LibFunctionDef(name = "getByName")
    public Varargs getByName(Varargs args) {
        return new LuaPlayer(Bukkit.getOfflinePlayer(args.checkjstring(1)));
    }

    @LibFunctionDef(name = "getByUUID")
    public Varargs getByUUID(Varargs args) {
        return new LuaPlayer(Bukkit.getOfflinePlayer(
                new LuaUUID(args.checkjstring(1)).getUUID()));
    }
}

Add getting players by UUIDs


package org.synyx.urlaubsverwaltung;

import no.api.freemarker.java8.Java8ObjectWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class FreemarkerConfig extends FreeMarkerAutoConfiguration {

    @Autowired
    private freemarker.template.Configuration configuration;

    public FreemarkerConfig(ApplicationContext applicationContext, FreeMarkerProperties properties) {
        super(applicationContext, properties);
    }

    @PostConstruct
    public void postConstruct() {
        configuration.setObjectWrapper(
            new Java8ObjectWrapper(freemarker.template.Configuration.getVersion()));
    }

}

package org.synyx.urlaubsverwaltung;

import no.api.freemarker.java8.Java8ObjectWrapper;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class FreemarkerConfig extends FreeMarkerAutoConfiguration {

    private final freemarker.template.Configuration configuration;

    public FreemarkerConfig(ApplicationContext applicationContext, FreeMarkerProperties properties, freemarker.template.Configuration configuration) {
        super(applicationContext, properties);
        this.configuration = configuration;
    }

    @PostConstruct
    public void postConstruct() {
        configuration.setObjectWrapper(new Java8ObjectWrapper(freemarker.template.Configuration.getVersion()));
    }
}

Replace field injection by constructor injection


package uk.org.taverna.scufl2.wfdesc;

import java.io.File;
import java.io.IOException;

import javax.xml.bind.JAXBException;

import uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.io.ReaderException;
import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
import uk.org.taverna.scufl2.api.io.WriterException;

public class ConvertToWfdesc {
	public static void main(String[] args) throws JAXBException, IOException,
			ReaderException, WriterException {
		WorkflowBundleIO io = new WorkflowBundleIO();
		for (String filepath : args) {
			File original = new File(filepath);
			String filename = original.getName();
			filename = filename.replaceFirst("\\..*", "") + ".wfdesc.ttl";
			File wfdesc = new File(original.getParentFile(), filename);
			WorkflowBundle wfBundle = io.readBundle(original, null);
			io.writeBundle(wfBundle, wfdesc,
					"text/vnd.wf4ever.wfdesc+turtle");
		}
	}
}

package uk.org.taverna.scufl2.wfdesc;

import java.io.File;
import java.io.IOException;

import javax.xml.bind.JAXBException;

import uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.io.ReaderException;
import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
import uk.org.taverna.scufl2.api.io.WriterException;

public class ConvertToWfdesc {
	public static void main(String[] args) throws JAXBException, IOException,
			ReaderException, WriterException {
		WorkflowBundleIO io = new WorkflowBundleIO();
		for (String filepath : args) {
			File original = new File(filepath);
			String filename = original.getName();
			filename = filename.replaceFirst("\\..*", "") + ".wfdesc.ttl";
			File wfdesc = new File(original.getParentFile(), filename);
			WorkflowBundle wfBundle = io.readBundle(original, null);
			io.writeBundle(wfBundle, wfdesc,
					"text/vnd.wf4ever.wfdesc+turtle");
			System.out.println("Converted " + original.getPath() + " to " + wfdesc.getPath());
		}
	}
}

Add system.out for each file converted


package edu.syr.pcpratts.rootbeer.testcases.rootbeertest.serialization;

import edu.syr.pcpratts.rootbeer.runtime.Kernel;

public class AutoboxingRunOnGpu implements Kernel {

  private Double m_result;
  public void gpuMethod() {
    m_result = returnDouble();
  }

  private double returnDouble() {
    return 10;
  }

  public double getResult(){
    return m_result;
  }

  public boolean compare(AutoboxingRunOnGpu rhs) {
    try {
      if(getResult() != rhs.getResult()){
        System.out.println("m_result");
        System.out.println("lhs: "+getResult());
        System.out.println("rhs: "+rhs.getResult());
        return false;
      }
      return true;
    } catch(Exception ex){
      System.out.println("exception thrown");
      return false;
    }
  }

}

package edu.syr.pcpratts.rootbeer.testcases.rootbeertest.serialization;

import edu.syr.pcpratts.rootbeer.runtime.Kernel;

public class AutoboxingRunOnGpu implements Kernel {

  private Double m_double_result;
  private Integer m_integer_result;
  public void gpuMethod() {
    m_double_result = returnDouble();
    m_integer_result = returnInteger();
  }

  private double returnDouble() {
    return 10;
  }

  private int returnInteger() {
    return 0;
    // values between -128 and 0 will fail because of problems in
    // static_getter_java_lang_Integer$IntegerCache_high or
    // static_getter_java_lang_Integer$IntegerCache_cache
    /*
       if ( i0  <  -128   ) goto label0;
       $i1  = static_getter_java_lang_Integer$IntegerCache_high(gc_info, exception);
       if ( i0  >  $i1   ) goto label0;
       $r0  = static_getter_java_lang_Integer$IntegerCache_cache(gc_info, exception);
       $i2  =  i0  +  128  ;
       $r1  = java_lang_Integer__array_get(gc_info, $r0, $i2, exception);
       if(*exception != 0) {
       return 0; }
       return  $r1 ;
     */
  }

  public double getDoubleResult(){
    return m_double_result;
  }

  public double getIntegerResult(){
    return m_integer_result;
  }

  public boolean compare(AutoboxingRunOnGpu rhs) {
    try {
      if(getDoubleResult() != rhs.getDoubleResult()){
        System.out.println("m_double_result");
        System.out.println("lhs: "+getDoubleResult());
        System.out.println("rhs: "+rhs.getDoubleResult());
        return false;
      }
      if(getIntegerResult() != rhs.getIntegerResult()){
        System.out.println("m_integer_result");
        System.out.println("lhs: "+getIntegerResult());
        System.out.println("rhs: "+rhs.getIntegerResult());
        return false;
      }
      return true;
    } catch(Exception ex){
      System.out.println("exception thrown");
      return false;
    }
  }

}

Update AutoboxingTest (Add Integer check)


package com.aware.plugin.term_collector;

import android.content.Context;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by wmb on 08.01.14.
 */
public class StopWords {
    private List<String> stopwords;

    public StopWords(Context context){
        this.stopwords = new ArrayList<String>();

        //GERMAN STOPWORDS by  Marco Götze, Steffen Geyer: http://solariz.de/649/deutsche-stopwords.htm;
        this.stopwords = new ArrayList<String>();

        InputStream buildinginfo = context.getResources().openRawResource(R.raw.stopwords);
        DataInputStream myDIS = new DataInputStream(buildinginfo);
        String myLine;

        //now loop through and check if we have input, if so append it to list
        try{
            while((myLine=myDIS.readLine())!=null) stopwords.add(myLine);
        } catch(IOException e){
            e.printStackTrace();
        }
    }

    public String[] filteredArray(String[] arrayToFilter) {
    ArrayList<String> resultList = new ArrayList<String>();
        for(String token : arrayToFilter ){
            if(!stopwords.contains(token.toLowerCase())){
                resultList.add(token);
            }
        }
    String[] result = new String[resultList.size()];
    return(resultList.toArray(result));
    }

    public boolean isStopWord(String token){
        return stopwords.contains(token.toLowerCase());
    }
}

package com.aware.plugin.term_collector;

import android.content.Context;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;

/**
 * Created by wmb on 08.01.14.
 */
public class StopWords {
    private HashSet<String> stopwords;

    public StopWords(Context context){
        //GERMAN STOPWORDS by  Marco Götze, Steffen Geyer: http://solariz.de/649/deutsche-stopwords.htm;
        this.stopwords = new HashSet<String>();

        InputStream buildinginfo = context.getResources().openRawResource(R.raw.stopwords);
        DataInputStream myDIS = new DataInputStream(buildinginfo);
        String myLine;

        //now loop through and check if we have input, if so append it to list
        try{
            while((myLine=myDIS.readLine())!=null) stopwords.add(myLine);
        } catch(IOException e){
            e.printStackTrace();
        }
    }

    public String[] filteredArray(String[] arrayToFilter) {
    ArrayList<String> resultList = new ArrayList<String>();
        for(String token : arrayToFilter ){
            if(!stopwords.contains(token.toLowerCase())){
                resultList.add(token);
            }
        }
    String[] result = new String[resultList.size()];
    return(resultList.toArray(result));
    }

    public boolean isStopWord(String token){
        return stopwords.contains(token.toLowerCase());
    }
}

Use HashSet instead of List


package blue.mesh;

import android.util.Log;

public class ReadWriteThread extends Thread {

    private final RouterObject    router;
    private final Connection      connection;
    private static final String   TAG = "ReadWriteThread";

    protected ReadWriteThread(RouterObject a_router, Connection a_connection){
        Log.d(TAG, "RWTHREAD CONNECTED!");

        router = a_router;
        connection = a_connection;
    }

    public void run() {
        byte[] buffer = null;

        // Keep listening to the InputStream while connected
        while (true) {

            if (this.isInterrupted()) {
                break;
            }

            int bytes = connection.read( buffer );
            if( bytes > 0 ){
                router.route(buffer, Constants.SRC_OTHER);
            }
        }

        disconnect();

        return;
    }

    private int disconnect(){
        // On exit close the in and out sockets and the Bluetooth socket
        router.notifyDisconnected(connection.getID(), this);
        connection.close();

        Log.d(TAG, "ReadWriteThread returned");
        return Constants.SUCCESS;
    }

    protected int write(byte[] buffer) {
        Log.d(TAG, "Writing bytes");
        connection.write( buffer );
        return Constants.SUCCESS;
    }

}

package blue.mesh;

import android.util.Log;

public class ReadWriteThread extends Thread {

    private final RouterObject    router;
    private final Connection      connection;
    private static final String   TAG = "ReadWriteThread";

    protected ReadWriteThread(RouterObject a_router, Connection a_connection){
        Log.d(TAG, "RWTHREAD CONNECTED!");

        router = a_router;
        connection = a_connection;
    }

    public void run() {
        byte[] buffer = new byte[Constants.MAX_MESSAGE_LEN];

        // Keep listening to the InputStream while connected
        while (true) {

            if (this.isInterrupted()) {
                break;
            }

            int bytes = connection.read( buffer );
            if( bytes > 0 ){
                Log.d(TAG, "Got something");
            }
            if( bytes > 0 && buffer != null ){
                Log.d(TAG, buffer.toString());
                byte[] returnBuffer = new byte[bytes];
                for( int i = 0; i < bytes; i++ ){
                    returnBuffer[i] = buffer[i];
                }
                router.route(returnBuffer, Constants.SRC_OTHER);
            }
        }

        disconnect();

        return;
    }

    private int disconnect(){
        // On exit close the in and out sockets and the Bluetooth socket
        router.notifyDisconnected(connection.getID(), this);
        connection.close();

        Log.d(TAG, "ReadWriteThread returned");
        return Constants.SUCCESS;
    }

    protected int write(byte[] buffer) {
        Log.d(TAG, "Writing bytes: " + buffer.toString() );
        connection.write( buffer );
        return Constants.SUCCESS;
    }

}

Cut the message buffer down before forwarding


package com.benberi.cadesim.server.model.player.vessel.impl;

import com.benberi.cadesim.server.model.player.Player;
import com.benberi.cadesim.server.model.player.vessel.CannonType;
import com.benberi.cadesim.server.model.player.vessel.Vessel;

public class WarBrig extends Vessel {

    public WarBrig(Player p) {
        super(p);
    }

    @Override
    public int getID() {
        return 5;
    }

    @Override
    public int getSize() {
        return 2;
    }

    @Override
    public int getInfluenceDiameter() {
        return 4;
    }

    @Override
    public int getMaxCannons() {
        return 12;
    }

    @Override
    public boolean isDualCannon() {
        return false;
    }

    @Override
    public boolean isManuaver() {
        return true;
    }

    @Override
    public double getMaxDamage() {
        return 16.66;
    }

    @Override
    public double getRamDamage() {
        return 1;
    }

    @Override
    public CannonType getCannonType() {
        return CannonType.LARGE;
    }
}

package com.benberi.cadesim.server.model.player.vessel.impl;

import com.benberi.cadesim.server.model.player.Player;
import com.benberi.cadesim.server.model.player.vessel.CannonType;
import com.benberi.cadesim.server.model.player.vessel.Vessel;

public class Junk extends Vessel {

    public Junk(Player p) {
        super(p);
    }

    @Override
    public int getID() {
        return 5;
    }

    @Override
    public int getSize() {
        return 2;
    }

    @Override
    public int getInfluenceDiameter() {
        return 4;
    }

    @Override
    public int getMaxCannons() {
        return 12;
    }

    @Override
    public boolean isDualCannon() {
        return false;
    }

    @Override
    public boolean isManuaver() {
        return true;
    }

    @Override
    public double getMaxDamage() {
        return 16.66;
    }

    @Override
    public double getRamDamage() {
        return 1;
    }

    @Override
    public CannonType getCannonType() {
        return CannonType.LARGE;
    }
}

Fix for something that should've changed automatically..


package com.github.endoscope.basic.ds;

import com.github.endoscope.storage.jdbc.DataSourceProvider;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

import javax.sql.DataSource;

import static org.slf4j.LoggerFactory.getLogger;

public class BasicDataSourceProvider implements DataSourceProvider {
    private static final Logger log = getLogger(BasicDataSourceProvider.class);

    public DataSource create(String initParam){
        if( StringUtils.isNotBlank(initParam) && initParam.startsWith("jdbc:postgresql") ){
            log.info("Detected jdbc:postgresql storage param for Endoscope - initializing BasicDataSource");
            try{
                BasicDataSource dataSource = new BasicDataSource();
                dataSource.setDriverClassName("org.postgresql.Driver");
                //DEBUG: loglevel=2
                //INFO: loglevel=1
                //dataSource.setUrl(initParam + "&loglevel=1");

                dataSource.setUrl(initParam);

                //We save statistics every 15min or even less often
                //There is no reason to keep connection open for so long unused
                dataSource.setMinEvictableIdleTimeMillis(55000);
                dataSource.setTimeBetweenEvictionRunsMillis(60000);

                return dataSource;
            }catch(Exception e){
                log.info("Failed to create custom Endoscope DataSource", e);
            }
        }
        return null;
    }
}

package com.github.endoscope.basic.ds;

import javax.sql.DataSource;

import com.github.endoscope.storage.jdbc.DataSourceProvider;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

import static org.slf4j.LoggerFactory.getLogger;

public class BasicDataSourceProvider implements DataSourceProvider {
    private static final Logger log = getLogger(BasicDataSourceProvider.class);

    public DataSource create(String initParam){
        if( StringUtils.isNotBlank(initParam) && initParam.startsWith("jdbc:postgresql") ){
            log.info("Detected jdbc:postgresql storage param for Endoscope - initializing BasicDataSource");
            try{
                BasicDataSource dataSource = new BasicDataSource();
                dataSource.setDriverClassName("org.postgresql.Driver");
                //DEBUG: loglevel=2
                //INFO: loglevel=1
                //dataSource.setUrl(initParam + "&loglevel=1");

                dataSource.setUrl(initParam);

                //We save statistics every 15min or even less often
                //There is no reason to keep connection open for so long unused
                dataSource.setMinEvictableIdleTimeMillis(55000);
                dataSource.setTimeBetweenEvictionRunsMillis(60000);

                dataSource.setMaxWaitMillis(60 * 60 * 1000);//1h
                dataSource.setDefaultQueryTimeout( 15 * 60 *  1000);//15min

                return dataSource;
            }catch(Exception e){
                log.info("Failed to create custom Endoscope DataSource", e);
            }
        }
        return null;
    }
}

Set DS default timeouts - don’t use inifnite values


/*
 * Copyright 2013 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.example.http.helloworld;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

public class HttpHelloWorldServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline p = ch.pipeline();

        p.addLast("codec", new HttpServerCodec());
        p.addLast("handler", new HttpHelloWorldServerHandler());
    }
}

/*
 * Copyright 2013 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.example.http.helloworld;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

public class HttpHelloWorldServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline p = ch.pipeline();

        // Uncomment the following line if you want HTTPS
        //SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine();
        //engine.setUseClientMode(false);
        //p.addLast("ssl", new SslHandler(engine));

        p.addLast("codec", new HttpServerCodec());
        p.addLast("handler", new HttpHelloWorldServerHandler());
    }
}

Make clear how to use HTTPS in the helloworld example


package com.kickstarter.libs;

import android.os.Parcelable;
import android.support.annotation.Nullable;

import org.joda.time.DateTime;

import auto.parcel.AutoParcel;

@AutoParcel
public abstract class RelativeDateTimeOptions implements Parcelable {
  // Abbreviates string, e.g.: "in 1 hr"
  public abstract boolean abbreviated();

  // Don't output tense, e.g.: "1 hour" instead of "in 1 hour"
  public abstract boolean absolute();

  // Compare against this date instead of the current time
  public abstract @Nullable DateTime relativeToDateTime();

  // Number of seconds difference permitted before an attempt to describe the relative date is abandoned.
  // For example, "738 days ago" is not helpful to users. The threshold defaults to 30 days.
  public abstract int threshold();

  @AutoParcel.Builder
  public abstract static class Builder {
    public abstract Builder abbreviated(boolean __);
    public abstract Builder absolute(boolean __);
    public abstract Builder relativeToDateTime(DateTime __);
    public abstract Builder threshold(int __);
    public abstract RelativeDateTimeOptions build();
  }

  public static Builder builder() {
    return new AutoParcel_RelativeDateOptions.Builder()
      .abbreviated(false)
      .absolute(false)
      .threshold(THIRTY_DAYS_IN_SECONDS);
  }

  public abstract Builder toBuilder();

  private final static int THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
}

package com.kickstarter.libs;

import android.os.Parcelable;
import android.support.annotation.Nullable;

import org.joda.time.DateTime;

import auto.parcel.AutoParcel;

@AutoParcel
public abstract class RelativeDateTimeOptions implements Parcelable {
  // Abbreviates string, e.g.: "in 1 hr"
  public abstract boolean abbreviated();

  // Don't output tense, e.g.: "1 hour" instead of "in 1 hour"
  public abstract boolean absolute();

  // Compare against this date instead of the current time
  public abstract @Nullable DateTime relativeToDateTime();

  // Number of seconds difference permitted before an attempt to describe the relative date is abandoned.
  // For example, "738 days ago" is not helpful to users. The threshold defaults to 30 days.
  public abstract int threshold();

  @AutoParcel.Builder
  public abstract static class Builder {
    public abstract Builder abbreviated(boolean __);
    public abstract Builder absolute(boolean __);
    public abstract Builder relativeToDateTime(DateTime __);
    public abstract Builder threshold(int __);
    public abstract RelativeDateTimeOptions build();
  }

  public static Builder builder() {
    return new AutoParcel_RelativeDateTimeOptions.Builder()
      .abbreviated(false)
      .absolute(false)
      .threshold(THIRTY_DAYS_IN_SECONDS);
  }

  public abstract Builder toBuilder();

  private final static int THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
}

Fix autogen code that was missed in refactor


package org.synyx.urlaubsverwaltung.api;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import static org.springframework.security.config.http.SessionCreationPolicy.NEVER;

@Configuration
@Order(1)
public class RestApiSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http
            .antMatcher("/api/**")
            .sessionManagement()
            .sessionCreationPolicy(NEVER)
            .and()
            .httpBasic()
            .and()
            .authorizeRequests()
            .antMatchers("/api/**").authenticated()
            .anyRequest().authenticated();
    }
}

package org.synyx.urlaubsverwaltung.api;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.synyx.urlaubsverwaltung.security.SecurityConfigurationProperties;

import static org.springframework.security.config.http.SessionCreationPolicy.NEVER;

@Configuration
@Order(1)
public class RestApiSecurityConfig extends WebSecurityConfigurerAdapter {

    private final boolean isOauth2Enabled;

    public RestApiSecurityConfig(SecurityConfigurationProperties properties) {
        isOauth2Enabled = "oidc".equalsIgnoreCase(properties.getAuth().name());
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http
            .antMatcher("/api/**")
            .sessionManagement()
              .sessionCreationPolicy(NEVER)
            .and()
            .authorizeRequests()
              .antMatchers("/api/**").authenticated()
              .anyRequest().authenticated();

        if (isOauth2Enabled) {
            http.oauth2Login();
        } else {
            http.httpBasic();
        }
    }
}

Add oidc for /api (swagger-ui)


package org.realityforge.replicant.client;

/**
 * The interface representing the set of changes to be applied to the EntityRepository.
 *
 *
The change set may represent several transactions but may be merged when transmitted to the client.
 * The sequence number identifies the last transaction to be included in the set.

 */
public interface ChangeSet
{
  /**
   * @return the sequence representing the last transaction in the change set.
   */
  int getSequence();

  /**
   * @return the number of change in set. Must be > 0.
   */
  int getChangeCount();

  /**
   * Return the change with specific index.
   *
   * @param index the index of the change.
   * @return the change.
   */
  Change getChange( int index );
}

package org.realityforge.replicant.client;

/**
 * The interface representing the set of changes to be applied to the EntityRepository.
 *
 *
The change set may represent several transactions but may be merged when transmitted to the client.
 * The sequence number identifies the last transaction to be included in the set.

 */
public interface ChangeSet
{
  /**
   * @return the sequence representing the last transaction in the change set.
   */
  int getSequence();

  /**
   * @return the number of changes in the set. Must be > 0.
   */
  int getChangeCount();

  /**
   * Return the change with specific index.
   *
   * @param index the index of the change.
   * @return the change.
   */
  Change getChange( int index );
}

Fix some language in javadocs


package se.jaitco.queueticketapi.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedisConfig {

    @Value("${redis.url}")
    private String redisUrl;

    @Value("${redis.password}")
    private String redisPassword;

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        SingleServerConfig singleServerConfig = config.useSingleServer()
                .setAddress(redisUrl);

        if (!redisPassword.isEmpty()) {
            singleServerConfig.setPassword(redisPassword);
        }
        return Redisson.create(config);
    }

}

package se.jaitco.queueticketapi.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedisConfig {

    @Value("${redis.url}")
    private String redisUrl;

    @Value("${redis.password}")
    private String redisPassword;

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        SingleServerConfig singleServerConfig = config.useSingleServer()
                .setAddress(redisUrl)
                .setConnectionPoolSize(20);

        if (!redisPassword.isEmpty()) {
            singleServerConfig.setPassword(redisPassword);
        }
        return Redisson.create(config);
    }

}

Upgrade to spring boot 2 and java 9


package com.jakewharton.resourcefs;

import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.util.Collections;
import java.util.Map;

import static com.jakewharton.resourcefs.ResourceFileSystemProvider.SCHEME;

public final class ResourceFileSystems {
  public static FileSystem create() {
    try {
      URI uri = URI.create(SCHEME + ":none");
      Map<String, ?> env = Collections.emptyMap();
      return FileSystems.newFileSystem(uri, env);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  private ResourceFileSystems() {
    throw new AssertionError("No instances.");
  }
}

package com.jakewharton.resourcefs;

import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.util.Collections;
import java.util.Map;

import static com.jakewharton.resourcefs.ResourceFileSystemProvider.SCHEME;

public final class ResourceFileSystems {
  public static FileSystem create() {
    try {
      URI uri = URI.create(SCHEME + ":none");
      Map<String, ?> env = Collections.emptyMap();
      return FileSystems.newFileSystem(uri, env, ResourceFileSystem.class.getClassLoader());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  private ResourceFileSystems() {
    throw new AssertionError("No instances.");
  }
}

Use current classloader for service loading fallback.


package com.leevilehtonen.cookagram.domain;

import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.Entity;
import javax.persistence.Lob;

@Entity
public class ImageEntity extends AbstractPersistable<Long> {

    private String name;
    private String mediaType;
    private Long size;

    @Lob
    private byte[] content;

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMediaType() {
        return mediaType;
    }

    public void setMediaType(String mediaType) {
        this.mediaType = mediaType;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }
}

package com.leevilehtonen.cookagram.domain;

import org.hibernate.annotations.Type;
import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.Entity;

@Entity
public class ImageEntity extends AbstractPersistable<Long> {

    private String name;
    private String mediaType;
    private Long size;

    @Type(type = "org.hibernate.type.BinaryType")
    private byte[] content;

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMediaType() {
        return mediaType;
    }

    public void setMediaType(String mediaType) {
        this.mediaType = mediaType;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }
}

Update image content type for Postgres


package ch.fadre.sandhills;

import java.awt.image.BufferedImage;
import java.io.IOException;

public class Main {

    public static final int width = 750;
    public static final int height = 750;
    public static final int ITERATIONS = 1000_000;

    public static void main(String[] args) throws IOException, InterruptedException {

        SandSimulation sandSimulation = new SandSimulation(width, height, ITERATIONS);
        short[][] result = sandSimulation.performSimulation();

        ImageWriter imageWriter = new ImageWriter();
        BufferedImage bufferedImage = imageWriter.generateImage(result, width, height);
        imageWriter.writeToFile(bufferedImage, "test");
        imageWriter.displayInFrame(bufferedImage);
    }

}

package ch.fadre.sandhills;

import java.awt.image.BufferedImage;
import java.io.IOException;

public class Main {

    public static int width = 100;
    public static int height = 200;
    public static long iterationCount = 100_000;

    public static void main(String[] args) throws IOException, InterruptedException {
        if(args == null || args.length == 0) {
            System.out.println("Warning: No parameters set, using defaults");
            showUsage();
        } else if (args.length == 3){
            width = Integer.parseInt(args[0]);
            height = Integer.parseInt(args[1]);
            iterationCount = Long.parseLong(args[2]);
            System.out.println("Starting simulation with grid (" + width+"w/" + height +"h) and " + iterationCount + " iterations...");
        } else {
            System.out.println("Too many parameters given! Using defaults");
            showUsage();
        }

        SandSimulation sandSimulation = new SandSimulation(width, height, iterationCount);
        short[][] result = sandSimulation.performSimulation();

        ImageWriter imageWriter = new ImageWriter();
        BufferedImage bufferedImage = imageWriter.generateImage(result, width, height);
        imageWriter.writeToFile(bufferedImage, "test");
        imageWriter.displayInFrame(bufferedImage);
    }

    private static void showUsage() {
        System.out.println("Usage: gradle run 500 500 10000");
    }

}

Allow to pass parameters as programm arguments


/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Use this package so that we can access package-private fields of TextInputLayout.
package com.google.android.material.textfield;

import android.content.Context;
import android.view.View;

public class MountableTextInputLayout extends TextInputLayout {

  private View.OnFocusChangeListener onFocusChangeListener = null;

  public MountableTextInputLayout(Context context) {
    super(context, null);
  }

  // Delegate the focus listener to the EditText
  @Override
  public void setOnFocusChangeListener(View.OnFocusChangeListener l) {
    onFocusChangeListener = l;
    if (editText == null) {
      return;
    }
    editText.setOnFocusChangeListener(l);
  }

  @Override
  public View.OnFocusChangeListener getOnFocusChangeListener() {
    return onFocusChangeListener;
  }
}

/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Use this package so that we can access package-private fields of TextInputLayout.
package com.google.android.material.textfield;

import android.content.Context;
import android.view.View;

public class MountableTextInputLayout extends TextInputLayout {

  private View.OnFocusChangeListener onFocusChangeListener = null;

  public MountableTextInputLayout(Context context) {
    super(context, null);
  }

  // Delegate the focus listener to the EditText
  @Override
  public void setOnFocusChangeListener(View.OnFocusChangeListener l) {
    onFocusChangeListener = l;
    if (editText == null) {
      return;
    }
    editText.setOnFocusChangeListener(l);
  }

  @Override
  public View.OnFocusChangeListener getOnFocusChangeListener() {
    return onFocusChangeListener;
  }

  @Override
  public void setOnClickListener(View.OnClickListener l) {
    if (editText != null) {
      editText.setOnClickListener(l);
    }
  }
}

Fix click handler in MaterialTextInputSpec


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache license, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the license for the specific language governing permissions and
 * limitations under the license.
 */
/**
 * SLF4J support.
 */
package org.apache.logging.slf4j;

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache license, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the license for the specific language governing permissions and
 * limitations under the license.
 */
/**
 * SLF4J support. Note that this does indeed share the same package namespace as the one found in log4j-to-slf4j;
 * this is intentional. The two JARs should not be used at the same time! Thus, in an OSGi environment
 * where split packages are not allowed, this error is prevented due to both JARs sharing an exported package name.
 */
package org.apache.logging.slf4j;

Clarify split package in docs.


/*
 * Copyright 2000-2015 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.vcs.log.impl;

import com.intellij.vcs.log.Hash;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @author erokhins
 */
public class HashEqualsTest {
  @Test
  public void testEqualsSelf() {
    Hash hash = HashImpl.build("adf");
    //noinspection EqualsWithItself
    assertTrue(hash.equals(hash));
  }

  @Test
  public void testEqualsNull() {
    Hash hash = HashImpl.build("adf");
    assertFalse(hash.equals(null));
  }

  @Test
  public void testEquals() {
    Hash hash1 = HashImpl.build("adf");
    Hash hash2 = HashImpl.build("adf");
    assertTrue(hash1.equals(hash2));
  }

  @Test
  public void testEqualsNone() {
    Hash hash1 = HashImpl.build("");
    Hash hash2 = HashImpl.build("");
    assertTrue(hash1.equals(hash2));
  }
}

/*
 * Copyright 2000-2015 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.vcs.log.impl;

import com.intellij.vcs.log.Hash;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author erokhins
 */
public class HashEqualsTest {
  @Test
  public void testEqualsSelf() {
    Hash hash = HashImpl.build("adf");
    assertThat(hash).isEqualTo(hash);
  }

  @Test
  public void testEqualsNull() {
    Hash hash = HashImpl.build("adf");
    assertThat(hash).isNotNull();
  }

  @Test
  public void testEquals() {
    Hash hash1 = HashImpl.build("adf");
    Hash hash2 = HashImpl.build("adf");
    assertThat(hash1).isEqualTo(hash2);
  }

  @Test
  public void testEqualsNone() {
    Hash hash1 = HashImpl.build("");
    Hash hash2 = HashImpl.build("");
    assertThat(hash1).isEqualTo(hash2);
  }
}

Test Hash comparisons using assertThat


package org.pdxfinder.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.Set;

/**
 * TreatmentSummary represents a summary of the application of a treatment protocol to a sample (either Human or Xenograft)
 */

@NodeEntity
public class TreatmentSummary {

    @GraphId
    Long id;

    @Relationship(type = "TREATMENT_PROTOCOL")
    Set<TreatmentProtocol> treatmentProtocols;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    ModelCreation modelCreation;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    PatientSnapshot patientSnapshot;

    public TreatmentSummary() {
    }

    public Set<TreatmentProtocol> getTreatmentProtocols() {
        return treatmentProtocols;
    }

    public void setTreatmentProtocols(Set<TreatmentProtocol> treatmentProtocols) {
        this.treatmentProtocols = treatmentProtocols;
    }

    public ModelCreation getModelCreation() {
        return modelCreation;
    }

    public void setModelCreation(ModelCreation modelCreation) {
        this.modelCreation = modelCreation;
    }

    public PatientSnapshot getPatientSnapshot() {
        return patientSnapshot;
    }

    public void setPatientSnapshot(PatientSnapshot patientSnapshot) {
        this.patientSnapshot = patientSnapshot;
    }
}

package org.pdxfinder.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.HashSet;
import java.util.Set;

/**
 * TreatmentSummary represents a summary of the application of a treatment protocol to a sample (either Human or Xenograft)
 */

@NodeEntity
public class TreatmentSummary {

    @GraphId
    Long id;

    @Relationship(type = "TREATMENT_PROTOCOL")
    Set<TreatmentProtocol> treatmentProtocols;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    ModelCreation modelCreation;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    PatientSnapshot patientSnapshot;

    public TreatmentSummary() {
    }

    public Set<TreatmentProtocol> getTreatmentProtocols() {
        return treatmentProtocols;
    }

    public void setTreatmentProtocols(Set<TreatmentProtocol> treatmentProtocols) {
        this.treatmentProtocols = treatmentProtocols;
    }

    public ModelCreation getModelCreation() {
        return modelCreation;
    }

    public void setModelCreation(ModelCreation modelCreation) {
        this.modelCreation = modelCreation;
    }

    public PatientSnapshot getPatientSnapshot() {
        return patientSnapshot;
    }

    public void setPatientSnapshot(PatientSnapshot patientSnapshot) {
        this.patientSnapshot = patientSnapshot;
    }

    public void addTreatmentProtocol(TreatmentProtocol tp){
        if(this.treatmentProtocols == null){
            this.treatmentProtocols = new HashSet<>();
        }
        this.treatmentProtocols.add(tp);
    }

}

Implement add method for TreatmentProtocols


package zmaster587.advancedRocketry.world.biome;

import java.util.LinkedList;
import java.util.List;

import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.world.biome.BiomeGenBase;

public class BiomeGenSpace extends BiomeGenBase {
	public BiomeGenSpace(int biomeId, boolean register) {
		super(biomeId, register);

		//cold and dry
		enableRain = false;
		enableSnow = false;
		rootHeight=-2f;
		heightVariation=0.00f;
		rainfall = 0f;
		temperature = 0.0f;
		this.theBiomeDecorator.generateLakes=false;
		this.theBiomeDecorator.flowersPerChunk=0;
		this.theBiomeDecorator.grassPerChunk=0;
		this.theBiomeDecorator.treesPerChunk=0;
		this.fillerBlock = this.topBlock = Blocks.air;
		this.biomeName="Space";
	}

	@Override
	public List getSpawnableList(EnumCreatureType p_76747_1_) {
		return new LinkedList<>();
	}

	@Override
	public float getSpawningChance() {
		return 0f; //Nothing spawns
	}
}

package zmaster587.advancedRocketry.world.biome;

import java.util.LinkedList;
import java.util.List;

import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.world.biome.BiomeGenBase;

public class BiomeGenSpace extends BiomeGenBase {
	public BiomeGenSpace(int biomeId, boolean register) {
		super(biomeId, register);

		//cold and dry
		enableRain = false;
		enableSnow = false;
		rootHeight=-2f;
		heightVariation=0.00f;
		rainfall = 0f;
		temperature = 1.0f;
		this.theBiomeDecorator.generateLakes=false;
		this.theBiomeDecorator.flowersPerChunk=0;
		this.theBiomeDecorator.grassPerChunk=0;
		this.theBiomeDecorator.treesPerChunk=0;
		this.fillerBlock = this.topBlock = Blocks.air;
		this.biomeName="Space";
	}

	@Override
	public List getSpawnableList(EnumCreatureType p_76747_1_) {
		return new LinkedList<>();
	}

	@Override
	public float getSpawningChance() {
		return 0f; //Nothing spawns
	}
}

Raise Temperature of space stations so snow stops forming everywhere


/**
 * Mutinack mutation detection program.
 * Copyright (C) 2014-2016 Olivier Cinquin
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package uk.org.cinquin.mutinack.misc_util.collections;

import java.util.stream.Collector;

import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;

public class TIntListCollector {

	public static<T> Collector<Integer, TIntList, TIntList> tIntListCollector() {
		return Collector.of(
				TIntArrayList::new,
				TIntList::add,
				(list1, list2) -> {
					list1.addAll(list2);
					return list1;
				},
				list -> list
				);
	}
}

/**
 * Mutinack mutation detection program.
 * Copyright (C) 2014-2016 Olivier Cinquin
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package uk.org.cinquin.mutinack.misc_util.collections;

import java.util.stream.Collector;

import org.eclipse.jdt.annotation.NonNull;

import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;

public class TIntListCollector {

	//Unused
	public static<T> Collector<@NonNull Integer, TIntList, TIntList> tIntListCollector() {
		return Collector.of(
				TIntArrayList::new,
				TIntList::add,
				(list1, list2) -> {
					list1.addAll(list2);
					return list1;
				},
				list -> list
				);
	}
}

Fix warning and mark method as unused.


package com.netflix.astyanax.serializers;

import java.nio.ByteBuffer;

import junit.framework.Assert;

import org.junit.Test;

public class SerializerPackageImplTest {
    @Test
    public void test() {
        SerializerPackageImpl serializers = new SerializerPackageImpl();
        try {
            serializers.setColumnType("CompositeType(UTF8Type, LongType)");
        } catch (UnknownComparatorException e) {
            e.printStackTrace();
            Assert.fail();
        }

        String input = "abc:123";
        ByteBuffer buffer = serializers.columnAsByteBuffer(input);
        String str = serializers.columnAsString(buffer);
        Assert.assertEquals(input, str);
    }
}

package com.netflix.astyanax.serializers;

import java.nio.ByteBuffer;

import junit.framework.Assert;

import org.junit.Test;

public class SerializerPackageImplTest {
    @Test
    public void test() {
        SerializerPackageImpl serializers = new SerializerPackageImpl();
        try {
            serializers.setColumnType("CompositeType(UTF8Type, LongType)");
        } catch (UnknownComparatorException e) {
            e.printStackTrace();
            Assert.fail();
        }

        String input = "abc:123";
        ByteBuffer buffer = serializers.columnAsByteBuffer(input);
        String str = serializers.columnAsString(buffer);
        Assert.assertEquals(input, str);
    }

    @Test
    public void testSetCompositeKeyType()
    {
        SerializerPackageImpl serializers = new SerializerPackageImpl();

        try {
            serializers.setKeyType( "CompositeType(UTF8Type, LongType)" );
        }
        catch ( UnknownComparatorException e ) {
            e.printStackTrace();
            Assert.fail();
        }
    }

    @Test
    public void testSetStandardKeyType()
    {
        SerializerPackageImpl serializers = new SerializerPackageImpl();

        try {
            serializers.setKeyType( "LongType" );
        }
        catch ( UnknownComparatorException e ) {
            e.printStackTrace();
            Assert.fail();
        }
    }
}

Add unit tests for set key type of SerializerPackageImpl


package com.sequenceiq.freeipa.client.auth;

import com.sequenceiq.freeipa.client.FreeIpaClientException;

public class PasswordExpiredException extends FreeIpaClientException {
    public PasswordExpiredException() {
        super("Invalid password");
    }

    @Override
    public boolean isClientUnusable() {
        return true;
    }
}

package com.sequenceiq.freeipa.client.auth;

import com.sequenceiq.freeipa.client.FreeIpaClientException;

public class PasswordExpiredException extends FreeIpaClientException {
    public PasswordExpiredException() {
        super("Password expired");
    }

    @Override
    public boolean isClientUnusable() {
        return true;
    }
}

Fix error message when the FreeIPA password has expired


/**
 * Copyright (C) 2014 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.gandalf.annotation;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.CLASS;

@Retention(CLASS)
@Target({ CONSTRUCTOR, METHOD })
public @interface GStrictMode {}

/**
 * Copyright (C) 2014 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.gandalf.annotation;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.CLASS;

/**
 *
Gandalf Strict Mode enables Android {@link android.os.StrictMode} on your application, so
 * when violations are detected, the logcat output will show information about these ones as they
 * happen.

 *
 *
REMEMBER: It is not necessary to annotate each method/constructor, it is enough with
 * just using the annotation on the main entry point of your app to activate
 * {@link android.os.StrictMode}. Thus this feature will live along the execution of your app.

 *
 *
FOR EXAMPLE: It is a good practice to annotate
 * {@link android.app.Activity#onCreate(android.os.Bundle)} method of your main activity or
 * {@link android.app.Application#onCreate()} method of your {@link android.app.Application} class
 * so the violations can be detected as they happen along the execution of your app.
 */
@Retention(CLASS)
@Target({ CONSTRUCTOR, METHOD })
public @interface GStrictMode {}

Add documentation to Gandalf Strict Mode annotation.


package com.blocksolid.okrello.api;

import com.facebook.stetho.okhttp3.StethoInterceptor;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Dan Buckland on 04/02/2016.
 */
public class ServiceGenerator {

    // public static final String BASE_URL = "https://api.trello.com/1/"; // production
    public static final String BASE_URL = "http://10.0.2.2:9292/"; // mock backend with emulator

    private static HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    private static Interceptor logging = interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);

    private static OkHttpClient httpClient = new OkHttpClient.Builder()
            .addNetworkInterceptor(new StethoInterceptor())
            .addInterceptor(logging)
            .build();

    private static Retrofit.Builder builder =
            new Retrofit.Builder()
                    .baseUrl(BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create());

    public static <S> S createService(Class<S> serviceClass) {
        Retrofit retrofit = builder.client(httpClient).build();
        return retrofit.create(serviceClass);
    }
}

package com.blocksolid.okrello.api;

import com.facebook.stetho.okhttp3.StethoInterceptor;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Dan Buckland on 04/02/2016.
 */
public class ServiceGenerator {

    // TODO move these to a Strings file which can be updated from rake task
    // public static final String BASE_URL = "https://api.trello.com/1/"; // production
    public static final String BASE_URL = "http://192.168.1.123:9292/"; // mock backend with emulator

    private static HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    private static Interceptor logging = interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);

    private static OkHttpClient httpClient = new OkHttpClient.Builder()
            .addNetworkInterceptor(new StethoInterceptor())
            .addInterceptor(logging)
            .build();

    private static Retrofit.Builder builder =
            new Retrofit.Builder()
                    .baseUrl(BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create());

    public static <S> S createService(Class<S> serviceClass) {
        Retrofit retrofit = builder.client(httpClient).build();
        return retrofit.create(serviceClass);
    }
}

Add temporary mock backend url to Android app for local testing


package net.moltendorf.Bukkit.IntelliDoors.controller;

import org.bukkit.block.Block;

/**
 * Created by moltendorf on 15/05/23.
 */
public class TrapDoor {
  public static Door getDoor(Block block) {
    return null;
  }
}

package net.moltendorf.Bukkit.IntelliDoors.controller;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;

/**
 * Created by moltendorf on 15/05/23.
 */
public class TrapDoor implements Door {
  public static Door getDoor(Block block) {
    return null;
  }

  private Material type;

  private Location location;

  protected Block block;

  protected byte data;

  public TrapDoor(Block block) {
    this.block = block;

    data = block.getData();
    location = block.getLocation();
    type = block.getType();
  }

  @Override
  public void open() {
    if (isClosed()) {
      data += 4;

      block.setData(data);
    }
  }

  @Override
  public void close() {
    if (isOpened()) {
      data -= 4;

      block.setData(data);
    }
  }

  @Override
  public void toggle() {
    data += isClosed() ? 4 : -4;

    block.setData(data);
  }

  @Override
  public boolean isOpened() {
    return (data & 4) == 4;
  }

  @Override
  public boolean isClosed() {
    return (data & 4) == 0;
  }

  @Override
  public Material getType() {
    return type;
  }

  @Override
  public void wasToggled(Door onDoor) {
    if (type == Material.IRON_TRAPDOOR) {
      if (isClosed()) {
        open();

        location.getWorld().playSound(location, Sound.BLOCK_IRON_TRAPDOOR_OPEN, 1, 1);
      } else {
        close();

        location.getWorld().playSound(location, Sound.BLOCK_IRON_TRAPDOOR_CLOSE, 1, 1);
      }
    }
  }
}

Implement trap door base functionality


package water.api;

import hex.ModelMetricsRegression;

public class ModelMetricsRegressionV3 extends ModelMetricsBase<ModelMetricsRegression, ModelMetricsRegressionV3> {
  @API(help="The Standard Deviation of the response for this scoring run.", direction=API.Direction.OUTPUT)
  public double sigma;

  @API(help="The Mean Squared Error of the prediction for this scoring run.", direction=API.Direction.OUTPUT)
  public double mse;
}

package water.api;

import hex.ModelMetricsRegression;

public class ModelMetricsRegressionV3 extends ModelMetricsBase<ModelMetricsRegression, ModelMetricsRegressionV3> {
  @API(help="The Standard Deviation of the response for this scoring run.", direction=API.Direction.OUTPUT)
  public double sigma;

  @API(help="The Mean Squared Error of the prediction for this scoring run.", direction=API.Direction.OUTPUT)
  public double mse;

  @Override public ModelMetricsRegressionV3 fillFromImpl(ModelMetricsRegression modelMetrics) {
    super.fillFromImpl(modelMetrics);
    this.mse = modelMetrics._mse;
    this.sigma = modelMetrics._sigma;
    return this;
  }
}

Add fillFromImpl for regression Model Metrics.


package poml.conv.basic;

import java.util.Map;

import poml.conv.Converter;
import poml.in.Poml;
import poml.out.Xml;

public class Property implements Converter {

  @Override public String name() { return "property"; }

  @Override public void convert(Poml poml, Xml xml) {
    Map<String, String> kv = poml.conf.map(name(), false);
    replaceKey(kv, encoding, encodings);
    replaceKey(kv, compiler, compilers);
    xml.println("  <properties>");
    xml.printKvTags(sp4, kv);
    xml.println("  </properties>");
  }

  private static final String encoding = "$encoding";
  private static final String[] encodings = {
    "project.build.sourceEncoding", "project.reporting.outputEncoding"
  };
  private static final String compiler = "$compiler";
  private static final String[] compilers = {
    "maven.compiler.source", "maven.compiler.target"
  };
  private void replaceKey(Map<String, String> kv, String from, String[] to) {
    if (!kv.containsKey(from)) return;
    String v = kv.remove(from);
    for (String k: to) kv.put(k, v);
  }
}

package poml.conv.basic;

import java.util.Map;

import poml.conv.Converter;
import poml.in.Poml;
import poml.out.Xml;

public class Property implements Converter {

  @Override public String name() { return "property"; }

  @Override public void convert(Poml poml, Xml xml) {
    Map<String, String> kv = poml.conf.map(name(), false);
    xml.println("  <properties>");
    for (String k: kv.keySet()) {
      if (k.startsWith("$")) replace(k, kv.get(k), xml);
      else xml.printKvTag(sp4, k, kv.get(k));
    }
    xml.println("  </properties>");
  }

  private void replace(String k, String v, Xml xml) {
    if ("$encoding".equals(k)) {
      xml.printKvTag(sp4, "project.build.sourceEncoding", v);
      xml.printKvTag(sp4, "project.reporting.outputEncoding", v);
    }
    else if ("$compiler".equals(k)) {
      xml.printKvTag(sp4, "maven.compiler.source", v);
      xml.printKvTag(sp4, "maven.compiler.target", v);
    }
  }
}

Update property to fix print ourder.


/***
 * Image/J Plugins
 * Copyright (C) 2002-2004 Jarek Sacha
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Latest release available at http://sourceforge.net/projects/ij-plugins/
 */
package net.sf.ij_plugins.filters;

import java.beans.SimpleBeanInfo;

/**
 * @author Jarek Sacha
 * @version $Revision: 1.1 $
 */
public class FluxAnisotropicDiffusionFilterBeanInfo extends SimpleBeanInfo {
}

/***
 * Image/J Plugins
 * Copyright (C) 2002-2005 Jarek Sacha
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Latest release available at http://sourceforge.net/projects/ij-plugins/
 */
package net.sf.ij_plugins.filters;

import net.sf.ij_plugins.util.IJPluginsSimpleBeanInfo;

/**
 * @author Jarek Sacha
 * @version $Revision: 1.2 $
 */
public class FluxAnisotropicDiffusionFilterBeanInfo extends IJPluginsSimpleBeanInfo {

    public FluxAnisotropicDiffusionFilterBeanInfo() {
        super(FluxAnisotropicDiffusionFilter.class);
    }
}

Use new base class for BeanInfo.


// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.sdk;

import java.io.IOException;

import org.chromium.sdk.util.MethodIsBlockingException;

/**
 * Abstraction of a remote JavaScript virtual machine which is embedded into
 * some application and accessed via TCP/IP connection to a port opened by
 * DebuggerAgent. Clients can use it to conduct debugging process.
 */
public interface StandaloneVm extends JavascriptVm {
  /**
   * Connects to the target VM.
   *
   * @param listener to report the debug events to
   * @throws IOException if there was a transport layer error
   * @throws UnsupportedVersionException if the SDK protocol version is not
   *         compatible with that supported by the browser
     * @throws MethodIsBlockingException because initialization implies couple of remote calls
     *     (to request version etc)
   */
  void attach(DebugEventListener listener)
      throws IOException, UnsupportedVersionException, MethodIsBlockingException;

  /**
   * @return name of embedding application as it wished to name itself; might be null
   */
  String getEmbedderName();

  /**
   * @return version of V8 implementation, format is unspecified; must not be null if
   *         {@link StandaloneVm} has been attached
   */
  // TODO: align this with {@link JavascriptVm#getVersion()} method.
  String getVmVersion();

  /**
   * @return message explaining why VM is detached; may be null
   */
  String getDisconnectReason();
}

// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.sdk;

import java.io.IOException;

import org.chromium.sdk.util.MethodIsBlockingException;

/**
 * Abstraction of a remote JavaScript virtual machine which is embedded into
 * some application and accessed via TCP/IP connection to a port opened by
 * DebuggerAgent. Clients can use it to conduct debugging process.
 */
public interface StandaloneVm extends JavascriptVm {
  /**
   * Connects to the target VM.
   *
   * @param listener to report the debug events to
   * @throws IOException if there was a transport layer error
   * @throws UnsupportedVersionException if the SDK protocol version is not
   *         compatible with that supported by the browser
     * @throws MethodIsBlockingException because initialization implies couple of remote calls
     *     (to request version etc)
   */
  void attach(DebugEventListener listener)
      throws IOException, UnsupportedVersionException, MethodIsBlockingException;

  /**
   * @return name of embedding application as it wished to name itself; might be null
   */
  String getEmbedderName();

  /**
   * This version should correspond to {@link JavascriptVm#getVersion()}. However it gets available
   * earlier, at the transport handshake stage.
   * @return version of V8 implementation, format is unspecified; must not be null if
   *         {@link StandaloneVm} has been attached
   */
  String getVmVersion();

  /**
   * @return message explaining why VM is detached; may be null
   */
  String getDisconnectReason();
}

Drop TODO for getVmVersion method


package scoutmgr.client.navbar;

import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.PresenterWidget;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
import com.gwtplatform.mvp.shared.proxy.PlaceRequest.Builder;
import scoutmgr.client.place.NameTokens;

public class NavbarPresenter
  extends PresenterWidget<NavbarPresenter.View>
  implements NavbarUiHandlers
{
  @Inject
  private PlaceManager _placeManager;

  @Override
  public void gotoEvents()
  {
    final PlaceRequest placeRequest = new Builder().nameToken( NameTokens.getEvents() ).build();
    _placeManager.revealPlace(placeRequest);
  }

  @Override
  public void gotoMembers()
  {
    final PlaceRequest placeRequest = new Builder().nameToken( NameTokens.getMembers() ).build();
    _placeManager.revealPlace(placeRequest);
  }

  interface View
    extends com.gwtplatform.mvp.client.View, HasUiHandlers<NavbarUiHandlers>
  {
  }

  @Inject
  NavbarPresenter( final EventBus eventBus,
                   final View view )
  {
    super( eventBus, view );

    getView().setUiHandlers( this );
  }
}

package scoutmgr.client.navbar;

import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.PresenterWidget;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
import com.gwtplatform.mvp.shared.proxy.PlaceRequest.Builder;
import scoutmgr.client.place.NameTokens;

public class NavbarPresenter
  extends PresenterWidget<NavbarPresenter.View>
  implements NavbarUiHandlers
{
  interface View
    extends com.gwtplatform.mvp.client.View, HasUiHandlers<NavbarUiHandlers>
  {
  }

  @Inject
  private PlaceManager _placeManager;

  @Override
  public void gotoEvents()
  {
    final PlaceRequest placeRequest = new Builder().nameToken( NameTokens.getEvents() ).build();
    _placeManager.revealPlace(placeRequest);
  }

  @Override
  public void gotoMembers()
  {
    final PlaceRequest placeRequest = new Builder().nameToken( NameTokens.getMembers() ).build();
    _placeManager.revealPlace(placeRequest);
  }

  @Inject
  NavbarPresenter( final EventBus eventBus,
                   final View view )
  {
    super( eventBus, view );

    getView().setUiHandlers( this );
  }
}

Move view to top of class


package com.izforge.izpack.api.data.binding;

/**
 * Listener entity
 *
 * @author Anthonin Bonnefoy
 */
public class Listener
{
    private String classname;

    private Stage stage;

    private OsModel os;

    private String jar;

    public Listener(String classname, Stage stage, OsModel os, String jar)
    {
        this.classname = classname;
        this.stage = stage;
        this.os = os;
        this.jar = jar;
    }

    public String getClassname()
    {
        return classname;
    }

    public String getJar()
    {
        return jar;
    }

    public Stage getStage()
    {
        return stage;
    }

    public OsModel getOs()
    {
        return os;
    }

    @Override
    public String toString()
    {
        return "Listener{" +
                "classname='" + classname + '\'' +
                ", stage=" + stage +
                ", os=" + os +
                '}';
    }
}

package com.izforge.izpack.api.data.binding;

import java.util.List;

/**
 * Listener entity
 *
 * @author Anthonin Bonnefoy
 */
public class Listener
{
    private String classname;

    private Stage stage;

    private List<OsModel> osList;

    private String jar;

    public Listener(String classname, Stage stage, List<OsModel> osList, String jar)
    {
        this.classname = classname;
        this.stage = stage;
        this.osList = osList;
        this.jar = jar;
    }

    public String getClassname()
    {
        return classname;
    }

    public String getJar()
    {
        return jar;
    }

    public Stage getStage()
    {
        return stage;
    }

    public List<OsModel> getOsList()
    {
        return osList;
    }

    @Override
    public String toString()
    {
        return "Listener{" +
                "classname='" + classname + '\'' +
                ", stage=" + stage +
                ", osList=" + osList +
                '}';
    }
}

Change os constraint to list of os in listener model


package net.mueller_martin.turirun.server;

import com.esotericsoftware.kryonet.Server;

public class TurirunServer {
	public static void main(String[] args) {
		System.out.println("Hello, world");
	}
}

package net.mueller_martin.turirun.server;

import java.io.IOException;

import com.esotericsoftware.kryonet.Server;

public class TurirunServer {
	public static void main(String[] args) {
		try {
			Server server = new Server();

			server.start();
			server.bind(1337, 7331);
		}
		catch (IOException e) {
			// TO DO: Fail
		}
	}
}

Implement simple TCP/UDP server with kryonet


package io.quarkus.deployment;

import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;

/**
 * This is used currently only to suppress warnings about unknown properties
 * when the user supplies something like: -Dquarkus.debug.reflection=true
 *
 * TODO refactor code to actually use these values
 */
@ConfigRoot
public class DebugConfig {

    /**
     * If set to true, writes a list of all reflective classes to META-INF
     */
    @ConfigItem(defaultValue = "false")
    boolean reflection;

    /**
     * If set to a directory, all generated classes will be written into that directory
     */
    @ConfigItem
    Optional<String> generatedClassesDir;
}

package io.quarkus.deployment;

import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;

/**
 * This is used currently only to suppress warnings about unknown properties
 * when the user supplies something like: -Dquarkus.debug.reflection=true
 *
 * TODO refactor code to actually use these values
 */
@ConfigRoot
public class DebugConfig {

    /**
     * If set to true, writes a list of all reflective classes to META-INF
     */
    @ConfigItem(defaultValue = "false")
    boolean reflection;

    /**
     * If set to a directory, all generated classes will be written into that directory
     */
    @ConfigItem
    Optional<String> generatedClassesDir;

    /**
     * If set to a directory, all transformed classes (e.g. Panache entities) will be written into that directory
     */
    @ConfigItem
    Optional<String> transformedClassesDir;

    /**
     * If set to a directory, ZIG files for generated code will be written into that directory.
     * <p>
     * A ZIG file is a textual representation of the generated code that is referenced in the stacktraces.
     */
    @ConfigItem
    Optional<String> generatedSourcesDir;
}

Add missing debug config to avoid warnings


package com.cardshifter.core.username;

import java.util.*;

/**
 * Instances of this class are guaranteed to be valid user names
 */
public class UserName {

    private static final int MIN_LENGTH = 1;
    private static final int MAX_LENGTH = 20;
    private static final Collection<String> reservedNames = Arrays.asList("Server", "undefined");

    private String name;

    private UserName(String name) {
        this.name = name;
    }

    /**
     * Try to create a new UserName object
     *
     * @param name Any string
     * @return A UserName guaranteed to be valid
     * @throws InvalidUserNameException If the proposed name is not valid
     */
    public static UserName create(String name) throws InvalidUserNameException {
        if (name.length() < MIN_LENGTH) {
            throw new InvalidUserNameException("Too short");
        }

        if (name.length() > MAX_LENGTH) {
            throw new InvalidUserNameException("Too long");
        }

        if (name.startsWith(" ") || name.endsWith(" ")) {
            throw new InvalidUserNameException("Starts or ends with space");
        }

        if (!name.matches("^[a-zA-Z0-9_ ]*$")) {
            throw new InvalidUserNameException("Invalid characters");
        }

        if (reservedNames.contains(name)) {
            throw new InvalidUserNameException("Reserved");
        }

        return new UserName(name);
    }

    public String asString() {
        return name;
    }

}

package com.cardshifter.core.username;

import java.util.*;

/**
 * Instances of this class are guaranteed to be valid user names
 */
public class UserName {

    private static final int MIN_LENGTH = 1;
    private static final int MAX_LENGTH = 20;
    private static final Collection<String> reservedNames = new HashSet<>(Arrays.asList("Server", "undefined"));

    private String name;

    private UserName(String name) {
        this.name = name;
    }

    /**
     * Try to create a new UserName object
     *
     * @param name Any string
     * @return A UserName guaranteed to be valid
     * @throws InvalidUserNameException If the proposed name is not valid
     */
    public static UserName create(String name) throws InvalidUserNameException {
        if (name.length() < MIN_LENGTH) {
            throw new InvalidUserNameException("Too short");
        }

        if (name.length() > MAX_LENGTH) {
            throw new InvalidUserNameException("Too long");
        }

        if (name.startsWith(" ") || name.endsWith(" ")) {
            throw new InvalidUserNameException("Starts or ends with space");
        }

        if (!name.matches("^[a-zA-Z0-9_ ]*$")) {
            throw new InvalidUserNameException("Invalid characters");
        }

        if (reservedNames.contains(name)) {
            throw new InvalidUserNameException("Reserved");
        }

        return new UserName(name);
    }

    public String asString() {
        return name;
    }

}

Use HashSet for reserved user names lookup


/**
 *  Copyright 2005-2016 Red Hat, Inc.
 *
 *  Red Hat licenses this file to you under the Apache License, version
 *  2.0 (the "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 *  implied.  See the License for the specific language governing
 *  permissions and limitations under the License.
 */
package io.fabric8.jgroups;

public class Constants {

    public static final short KUBERNETES_DISCOVERY_ID = 1001;

    public static final String JGROUPS_CLUSTER_NAME = "cluster";
    public static final String JGROUPS_TCP_PORT = "jgroups-tcp-port";
}

/**
 *  Copyright 2005-2016 Red Hat, Inc.
 *
 *  Red Hat licenses this file to you under the Apache License, version
 *  2.0 (the "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 *  implied.  See the License for the specific language governing
 *  permissions and limitations under the License.
 */
package io.fabric8.jgroups;

public class Constants {

    public static final short KUBERNETES_DISCOVERY_ID = 1001;

    public static final String JGROUPS_CLUSTER_NAME = "cluster";
    public static final String JGROUPS_TCP_PORT = "jgroups-tcp";
}

Use valid k8s port name


package com.aemreunal.repository.scenario;

/*
 ***************************
 * Copyright (c) 2014      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 ***************************
 */

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
import com.aemreunal.domain.Scenario;

public interface ScenarioRepo extends CrudRepository<Scenario, Long>, JpaSpecificationExecutor {
}

package com.aemreunal.repository.scenario;

/*
 ***************************
 * Copyright (c) 2014      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 ***************************
 */

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
import com.aemreunal.domain.Project;
import com.aemreunal.domain.Scenario;

public interface ScenarioRepo extends CrudRepository<Scenario, Long>, JpaSpecificationExecutor {
    public Scenario findByScenarioIdAndProject(Long scenarioId, Project project);
}

Add Scenario repo search method


package com.fluentinterface;

import com.fluentinterface.domain.Person;
import org.junit.Test;

import static com.fluentinterface.domain.PersonAnnotatedBuilder.aPerson;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class BuilderWithAnnotationsTest {

    @Test
    public void testCanUseConstructorFromAnnotatedMethod() {

        Person built = aPerson().with("name", 16).build();

        assertThat(built.getName(), is("name"));
        assertThat(built.getAge(), is(16));
    }

    @Test
    public void testCanUseConverterFromSetsAnnotatedMethod() {

        Person built = aPerson().withAge("16").build();

        assertThat(built.getAge(), is(16));
    }
}

package com.fluentinterface;

import com.fluentinterface.domain.Person;
import org.junit.Test;

import static com.fluentinterface.domain.PersonAnnotatedBuilder.aPerson;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class BuilderWithAnnotationsTest {

    @Test
    public void testCanUseConstructorFromAnnotatedMethod() {

        Person built = aPerson().with("name", 16).build();

        assertThat(built.getName(), is("name"));
        assertThat(built.getAge(), is(16));
    }

    @Test
    public void testAlwaysUsesLastConstructsInvocationParameterToInstantiateObject() {

        Person built = aPerson()
                .with("name", 16)
                .with("last name", 99)
                .build();

        assertThat(built.getName(), is("last name"));
        assertThat(built.getAge(), is(99));
    }

    @Test
    public void testCanUseConverterFromSetsAnnotatedMethod() {

        Person built = aPerson().withAge("16").build();

        assertThat(built.getAge(), is(16));
    }
}

Add test for multiple invocations of methods annotated with `@Constructs`


package io.github.aquerr.eaglefactions.common.util;

import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource;

public class ModSupport
{
    /**
     * Checks if the given class comes from TechGuns
     * @param clazz class to check
     * @param <T> the type of class
     * @return <tt>true</tt> if class comes from TechGuns, <tt>false</tt> if not.
     */
    public static <T> boolean isTechGuns(final Class<T> clazz)
    {
        return clazz.getName().contains("techguns");
    }

    /**
     * Gets the attacking entity from the EntityDamageSource. EntityDamageSource must come from TechGuns.
     * @param entityDamageSource the source
     * @return attacking/source entity.
     */
    public static Entity getAttackerFromTechGuns(final EntityDamageSource entityDamageSource)
    {
        Object attacker = null;
        try
        {
            attacker = entityDamageSource.getClass().getField("attacker").get(entityDamageSource);
        }
        catch (IllegalAccessException | NoSuchFieldException e)
        {
            e.printStackTrace();
        }
        if (attacker instanceof Entity)
            return (Entity)attacker;
        else return null;
    }
}

package io.github.aquerr.eaglefactions.common.util;

import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource;

public class ModSupport
{
    /**
     * Checks if the given class comes from TechGuns
     * @param clazz class to check
     * @param <T> the type of class
     * @return <tt>true</tt> if class comes from TechGuns, <tt>false</tt> if not.
     */
    public static <T> boolean isTechGuns(final Class<T> clazz)
    {
        return clazz.getName().contains("techguns");
    }

    /**
     * Checks if the given class comes from AncientWarfare
     * @param clazz class to check
     * @param <T> the type of class
     * @return <tt>true</tt> if class comes from AncientWarfare, <tt>false</tt> if not.
     */
    public static <T> boolean isAncientWarfare(final Class<T> clazz)
    {
        return clazz.getName().contains("ancientwarfare");
    }

    /**
     * Gets the attacking entity from the EntityDamageSource. EntityDamageSource must come from TechGuns.
     * @param entityDamageSource the source
     * @return attacking/source entity.
     */
    public static Entity getAttackerFromTechGuns(final EntityDamageSource entityDamageSource)
    {
        Object attacker = null;
        try
        {
            attacker = entityDamageSource.getClass().getField("attacker").get(entityDamageSource);
        }
        catch (IllegalAccessException | NoSuchFieldException e)
        {
            e.printStackTrace();
        }
        if (attacker instanceof Entity)
            return (Entity)attacker;
        else return null;
    }
}

Add method for checking if class comes from Ancient Warfare


package SW9.model_canvas.arrow_heads;

import javafx.scene.paint.Color;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;

public class SimpleArrowHead extends ArrowHead {

    private static final double TRIANGLE_LENGTH = 20d;
    private static final double TRIANGLE_WIDTH = 15d;

    public SimpleArrowHead() {
        super();

        addChild(initializeTriangle());
    }

    private Path initializeTriangle() {
        final Path simpleArrow = new Path();

        MoveTo start = new MoveTo();
        LineTo l1 = new LineTo();
        MoveTo l2 = new MoveTo();
        LineTo l3 = new LineTo();

        start.xProperty().bind(xProperty);
        start.yProperty().bind(yProperty);

        l1.xProperty().bind(start.xProperty().subtract(TRIANGLE_WIDTH / 2));
        l1.yProperty().bind(start.yProperty().subtract(TRIANGLE_LENGTH));

        l2.xProperty().bind(start.xProperty().add(TRIANGLE_WIDTH / 2));
        l2.yProperty().bind(start.yProperty().subtract(TRIANGLE_LENGTH));

        l3.xProperty().bind(start.xProperty());
        l3.yProperty().bind(start.yProperty());

        simpleArrow.setStroke(Color.BLACK);
        simpleArrow.getElements().addAll(start, l1, l2, l3);

        return simpleArrow;
    }

    @Override
    public double getHeadHeight() {
        return TRIANGLE_LENGTH;
    }

    @Override
    public double getHeadWidth() {
        return TRIANGLE_WIDTH;
    }

    @Override
    public boolean shouldBindToTip() {
        return true;
    }

}

package SW9.model_canvas.arrow_heads;

import javafx.scene.paint.Color;
import javafx.scene.shape.*;

public class SimpleArrowHead extends ArrowHead {

    private static final double TRIANGLE_LENGTH = 20d;
    private static final double TRIANGLE_WIDTH = 15d;

    public SimpleArrowHead() {
        super();

        addChildren(initializeLeftArrow(), initializeRightArrow());
    }

    private Line initializeLeftArrow() {
        final Line leftArrow = new Line();
        leftArrow.startXProperty().bind(xProperty);
        leftArrow.startYProperty().bind(yProperty);
        leftArrow.endXProperty().bind(xProperty.subtract(TRIANGLE_WIDTH / 2));
        leftArrow.endYProperty().bind(yProperty.subtract(TRIANGLE_LENGTH));

        return leftArrow;
    }

    private Line initializeRightArrow() {
        final Line rightArrow = new Line();
        rightArrow.startXProperty().bind(xProperty);
        rightArrow.startYProperty().bind(yProperty);
        rightArrow.endXProperty().bind(xProperty.add(TRIANGLE_WIDTH / 2));
        rightArrow.endYProperty().bind(yProperty.subtract(TRIANGLE_LENGTH));

        return rightArrow;
    }

    @Override
    public double getHeadHeight() {
        return TRIANGLE_LENGTH;
    }

    @Override
    public double getHeadWidth() {
        return TRIANGLE_WIDTH;
    }

    @Override
    public boolean shouldBindToTip() {
        return true;
    }

}

Refactor simple arrow head to use two lines instead of path


package com.me.ui.sample.library.config;

import com.me.ui.sample.SampleApplicationLike;

import java.io.File;

/**
 * @author kylingo on 18/10/11
 */
public class MePath {

    public static final String PATH_LOG = getCachePath("log");

    private static String getCachePath(String path) {
        File cacheDir = SampleApplicationLike.getContext().getExternalCacheDir();
        if (cacheDir != null) {
            File child = new File(cacheDir, path);
            if (child.mkdirs()) {
                return child.getAbsolutePath();
            }
        }

        return null;
    }
}

package com.me.ui.sample.library.config;

import com.me.ui.sample.SampleApplicationLike;

import java.io.File;

/**
 * @author kylingo on 18/10/11
 */
public class MePath {

    public static final String PATH_LOG = getCachePath("log");

    private static String getCachePath(String path) {
        File cacheDir = SampleApplicationLike.getContext().getExternalCacheDir();
        if (cacheDir != null) {
            File child = new File(cacheDir, path);
            if (!child.exists()) {
                child.mkdirs();
            }
            return child.getAbsolutePath();
        }

        return null;
    }
}

Fix Mlog init cache path issue


package uworkers.core.endpoint;

import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.TextMessage;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class ParametrizedRequest {

	final TextMessage message;
	final MessageProducer producer;

	public ParametrizedRequest setCorrelationId( String id ) throws JMSException {
		message.setJMSCorrelationID(id);
		return this;
	}

	public ParametrizedRequest setMessageId( String id ) throws JMSException {
		message.setJMSMessageID(id);
		return this;
	}

	public void send() throws JMSException {
		producer.send(message);
	}
}

package uworkers.core.endpoint;

import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.TextMessage;

import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@RequiredArgsConstructor
public class ParametrizedRequest {

	@NonNull TextMessage message;
	final MessageProducer producer;

	public ParametrizedRequest setCorrelationId( String id ) throws JMSException {
		message.setJMSCorrelationID(id);
		return this;
	}

	public ParametrizedRequest setMessageId( String id ) throws JMSException {
		message.setJMSMessageID(id);
		return this;
	}

	public TextMessage send() throws JMSException {
		producer.send(message);
		return message;
	}
}

Allow developers to inspect sent JMS message


package com.crowdin.cli.commands.functionality;

import com.crowdin.cli.properties.CliProperties;
import com.crowdin.cli.properties.Params;
import com.crowdin.cli.properties.PropertiesBean;
import com.crowdin.cli.utils.file.FileReader;

import java.io.File;
import java.nio.file.Files;

public class PropertiesBuilder {

    private File configFile;
    private File identityFile;
    private Params params;

    public PropertiesBuilder(File configFile, File identityFile, Params params) {
        this.configFile = configFile;
        this.identityFile = identityFile;
        this.params = params;
    }

    public PropertiesBean build() {
        PropertiesBean pb = (!(Files.notExists(configFile.toPath()) && params != null))
            ? CliProperties.buildFromMap(new FileReader().readCliConfig(configFile))
            : new PropertiesBean();
        if (identityFile != null) {
            CliProperties.populateWithCredentials(pb, new FileReader().readCliConfig(configFile));
        }
        if (params != null) {
            CliProperties.populateWithParams(pb, params);
        }
        String basePathIfEmpty = (Files.exists(configFile.toPath()) && !(params != null && params.getBasePathParam() != null))
            ? new File(configFile.getAbsolutePath()).getParent()
            : System.getProperty("user.dir");
        return CliProperties.processProperties(pb, basePathIfEmpty);
    }
}

package com.crowdin.cli.commands.functionality;

import com.crowdin.cli.properties.CliProperties;
import com.crowdin.cli.properties.Params;
import com.crowdin.cli.properties.PropertiesBean;
import com.crowdin.cli.utils.file.FileReader;

import java.io.File;
import java.nio.file.Files;

public class PropertiesBuilder {

    private File configFile;
    private File identityFile;
    private Params params;

    public PropertiesBuilder(File configFile, File identityFile, Params params) {
        this.configFile = configFile;
        this.identityFile = identityFile;
        this.params = params;
    }

    public PropertiesBean build() {
        PropertiesBean pb = (!(Files.notExists(configFile.toPath()) && params != null))
            ? CliProperties.buildFromMap(new FileReader().readCliConfig(configFile))
            : new PropertiesBean();
        if (identityFile != null) {
            CliProperties.populateWithCredentials(pb, new FileReader().readCliConfig(configFile));
        }
        if (params != null) {
            CliProperties.populateWithParams(pb, params);
        }
        String basePathIfEmpty = (Files.exists(configFile.toPath()) && !(params != null && params.getBasePathParam() != null))
            ? new File(configFile.getAbsolutePath()).getParent()
            : "";
        return CliProperties.processProperties(pb, basePathIfEmpty);
    }
}

Fix for absolute paths when using params