package me.nallar.javapatcher.mappings;

import java.util.*;

/**
 * Maps method/field/class names in patches to allow obfuscated code to be patched.
 */
public abstract class Mappings {
	/**
	 * Takes a list of Class/Method/FieldDescriptions and maps them all using the appropriate map(*Description)
	 *
	 * @param list List of Class/Method/FieldDescriptions
	 * @return Mapped List
	 */
	@SuppressWarnings("unchecked")
	public final <T> List<T> map(List<T> list) {
		List<T> mappedThings = new ArrayList();
		for (Object thing : list) {
			// TODO - cleaner way of doing this?
			if (thing instanceof MethodDescription) {
				mappedThings.add((T) map((MethodDescription) thing));
			} else if (thing instanceof ClassDescription) {
				mappedThings.add((T) map((ClassDescription) thing));
			} else if (thing instanceof FieldDescription) {
				mappedThings.add((T) map((FieldDescription) thing));
			} else {
				throw new IllegalArgumentException("Must be mappable: " + thing + "isn't!");
			}
		}
		return mappedThings;
	}

	public abstract MethodDescription map(MethodDescription methodDescription);

	public abstract ClassDescription map(ClassDescription classDescription);

	public abstract FieldDescription map(FieldDescription fieldDescription);

	public abstract MethodDescription unmap(MethodDescription methodDescription);

	public abstract String obfuscate(String code);
}

package me.nallar.javapatcher.mappings;

import java.util.*;

/**
 * Maps method/field/class names in patches to allow obfuscated code to be patched.
 */
public abstract class Mappings {
	/**
	 * Takes a list of Class/Method/FieldDescriptions and maps them all using the appropriate map(*Description)
	 *
	 * @param list List of Class/Method/FieldDescriptions
	 * @return Mapped List
	 */
	@SuppressWarnings("unchecked")
	public final <T> List<T> map(List<T> list) {
		List<T> mappedThings = new ArrayList<T>();
		for (Object thing : list) {
			// TODO - cleaner way of doing this?
			if (thing instanceof MethodDescription) {
				mappedThings.add((T) map((MethodDescription) thing));
			} else if (thing instanceof ClassDescription) {
				mappedThings.add((T) map((ClassDescription) thing));
			} else if (thing instanceof FieldDescription) {
				mappedThings.add((T) map((FieldDescription) thing));
			} else {
				throw new IllegalArgumentException("Must be mappable: " + thing + "isn't!");
			}
		}
		return mappedThings;
	}

	public abstract MethodDescription map(MethodDescription methodDescription);

	public abstract ClassDescription map(ClassDescription classDescription);

	public abstract FieldDescription map(FieldDescription fieldDescription);

	public abstract MethodDescription unmap(MethodDescription methodDescription);

	public abstract String obfuscate(String code);
}

Fix missed raw type ArrayList


package site;

import org.apache.felix.ipojo.configuration.Configuration;
import org.apache.felix.ipojo.configuration.Instance;

/**
 * Declares an instance of the asset controller to server $basedir/documentation.
 * The goal is to have the external documentation (reference, mojo and javadoc) structured as follows:
 *
 * {@literal documentation/reference/0.4}
 * {@literal documentation/reference/0.5-SNAPSHOT}
 * {@literal documentation/wisdom-maven-plugin/0.4}
 * {@literal documentation/wisdom-maven-plugin/0.5-SNAPSHOT}
 * {@literal documentation/apidocs/0.4}
 * {@literal documentation/apidocs/0.5-SNAPSHOT}
 * ...
 */
@Configuration
public class DocConfiguration {

    /**
     * Declares the instance of resource controller serving resources from 'basedir/documentation'.
     */
    Instance instance = Instance.instance().of("org.wisdom.resources.ResourceController")
            .named("Documentation-Resources")
            .with("path").setto("documentation");
}

package site;

import org.apache.felix.ipojo.configuration.Configuration;
import org.apache.felix.ipojo.configuration.Instance;

/**
 * Declares an instance of the asset controller to server $basedir/documentation.
 * The goal is to have the external documentation (reference, mojo and javadoc) structured as follows:
 * <p/>
 * {@literal documentation/reference/0.4}
 * {@literal documentation/reference/0.5-SNAPSHOT}
 * {@literal documentation/wisdom-maven-plugin/0.4}
 * {@literal documentation/wisdom-maven-plugin/0.5-SNAPSHOT}
 * {@literal documentation/apidocs/0.4}
 * {@literal documentation/apidocs/0.5-SNAPSHOT}
 * ...
 */
@Configuration
public class DocConfiguration {

    /**
     * Declares the instance of resource controller serving resources from 'basedir/documentation'.
     */
    public static Instance declareTheDocumentationController() {
        return Instance.instance().of("org.wisdom.resources.AssetController")
                .named("Documentation-Resources")
                .with("path").setto("documentation");
    }
}

Update the resource controller instance. The class has changed.


package com.metacodestudio.hotsuploader;

import com.metacodestudio.hotsuploader.controllers.HomeController;
import io.datafx.controller.flow.Flow;
import io.datafx.controller.flow.FlowHandler;
import io.datafx.controller.flow.container.DefaultFlowContainer;
import io.datafx.controller.flow.context.ViewFlowContext;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class Client extends Application {

    public static void main(String[] args) {
        Application.launch(Client.class, args);
    }

    @Override
    public void start(final Stage primaryStage) throws Exception {
        Flow flow = new Flow(HomeController.class);
        FlowHandler flowHandler = flow.createHandler(new ViewFlowContext());
        DefaultFlowContainer container = new DefaultFlowContainer();
        StackPane pane = flowHandler.start(container);
        primaryStage.setScene(new Scene(pane));
        primaryStage.setOnCloseRequest(event -> System.exit(0));
        primaryStage.show();
    }

}

package com.metacodestudio.hotsuploader;

import com.metacodestudio.hotsuploader.controllers.HomeController;
import io.datafx.controller.flow.Flow;
import io.datafx.controller.flow.FlowHandler;
import io.datafx.controller.flow.container.DefaultFlowContainer;
import io.datafx.controller.flow.context.ViewFlowContext;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.File;

public class Client extends Application {

    private static File hotsRoot;

    public static File getHotsRoot() {
        return hotsRoot;
    }

    public static void main(String[] args) {
        hotsRoot = getRootDirectory();
        Application.launch(Client.class, args);
    }

    private static File getRootDirectory() {
        StringBuilder builder = new StringBuilder(System.getProperty("user.home"));
        if (isWindows()) {
            builder.append("\\Documents\\Heroes of the Storm\\Accounts\\");
        } else if (isMacintosh()) {
            builder.append("/Library/Application Support/Blizzard/Heroes of the Storm/Accounts/");
        } else {
            throw new UnsupportedOperationException("This application requires Windows or Macintosh OSX to run");
        }
        return new File(builder.toString());
    }

    private static boolean isMacintosh() {
        // TODO DETERMINE MACINTOSH PROPERTIES
        throw new UnsupportedOperationException("Macintosh check not yet implemented");
    }

    private static boolean isWindows() {
        String osName = System.getProperty("os.name");
        return osName.contains("Windows");
    }

    @Override
    public void start(final Stage primaryStage) throws Exception {
        Flow flow = new Flow(HomeController.class);
        FlowHandler flowHandler = flow.createHandler(new ViewFlowContext());
        DefaultFlowContainer container = new DefaultFlowContainer();
        StackPane pane = flowHandler.start(container);
        primaryStage.setScene(new Scene(pane));
        primaryStage.setOnCloseRequest(event -> System.exit(0));
        primaryStage.show();
    }

}

Add reference to root file


/*
 * Copyright 2013-present Facebook, Inc.
 *
 * 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.facebook.buck.testutil;

import com.google.common.base.Function;

import java.nio.file.Path;
import java.nio.file.Paths;

public class IdentityPathRelativizer {

  private IdentityPathRelativizer() {
    // Utility class
  }

  public static Function<String, Path> getIdentityRelativizer() {
    return new Function<String, Path>() {
      @Override
      public Path apply(String input) {
        return Paths.get(input);
      }
    };
  }
}

/*
 * Copyright 2013-present Facebook, Inc.
 *
 * 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.facebook.buck.testutil;

import com.google.common.base.Function;

import java.nio.file.Path;
import java.nio.file.Paths;

public class IdentityPathRelativizer {

  /** Utility class: do not instantiate. */
  private IdentityPathRelativizer() {}

  public static Function<String, Path> getIdentityRelativizer() {
    return new Function<String, Path>() {
      @Override
      public Path apply(String input) {
        return Paths.get(input);
      }
    };
  }
}

Use consistent comment for utility class constructor.


package org.bouncycastle.math.field;

import java.math.BigInteger;

public abstract class FiniteFields
{
    static final FiniteField GF_2 = new PrimeField(BigInteger.valueOf(2));
    static final FiniteField GF_3 = new PrimeField(BigInteger.valueOf(3));

    public static PolynomialExtensionField getBinaryExtensionField(int[] exponents)
    {
        return new GenericPolynomialExtensionField(GF_2, new GF2Polynomial(exponents));
    }

    public static FiniteField getPrimeField(BigInteger characteristic)
    {
        characteristic = characteristic.abs();

        int bitLength = characteristic.bitLength();
        if (bitLength < 3)
        {
            if (bitLength < 2)
            {
                throw new IllegalArgumentException("'characteristic' must be >= 2");
            }

            switch (characteristic.intValue())
            {
            case 2:
                return GF_2;
            case 3:
                return GF_3;
            }
        }

        return new PrimeField(characteristic);
    }
}

package org.bouncycastle.math.field;

import java.math.BigInteger;

public abstract class FiniteFields
{
    static final FiniteField GF_2 = new PrimeField(BigInteger.valueOf(2));
    static final FiniteField GF_3 = new PrimeField(BigInteger.valueOf(3));

    public static PolynomialExtensionField getBinaryExtensionField(int[] exponents)
    {
        if (exponents[0] != 0)
        {
            throw new IllegalArgumentException("Irreducible polynomials in GF(2) must have constant term");
        }
        for (int i = 1; i < exponents.length; ++i)
        {
            if (exponents[i] <= exponents[i - 1])
            {
                throw new IllegalArgumentException("Polynomial exponents must be montonically increasing");
            }
        }

        return new GenericPolynomialExtensionField(GF_2, new GF2Polynomial(exponents));
    }

//    public static PolynomialExtensionField getTernaryExtensionField(Term[] terms)
//    {
//        return new GenericPolynomialExtensionField(GF_3, new GF3Polynomial(terms));
//    }

    public static FiniteField getPrimeField(BigInteger characteristic)
    {
        int bitLength = characteristic.bitLength();
        if (characteristic.signum() <= 0 || bitLength < 2)
        {
            throw new IllegalArgumentException("'characteristic' must be >= 2");
        }

        if (bitLength < 3)
        {
            switch (characteristic.intValue())
            {
            case 2:
                return GF_2;
            case 3:
                return GF_3;
            }
        }

        return new PrimeField(characteristic);
    }
}

Improve argument checks and add hint of future ternary extensions


package eu.kanade.mangafeed.data.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.support.annotation.NonNull;

import eu.kanade.mangafeed.data.database.tables.ChapterSyncTable;
import eu.kanade.mangafeed.data.database.tables.ChapterTable;
import eu.kanade.mangafeed.data.database.tables.MangaTable;

public class DbOpenHelper extends SQLiteOpenHelper {

    public static final String DATABASE_NAME = "mangafeed.db";
    public static final int DATABASE_VERSION = 2;

    public DbOpenHelper(@NonNull Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(@NonNull SQLiteDatabase db) {
        db.execSQL(MangaTable.getCreateTableQuery());
        db.execSQL(ChapterTable.getCreateTableQuery());
    }

    @Override
    public void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion) {
        if (oldVersion == 1)
            db.execSQL(ChapterSyncTable.getCreateTableQuery());
    }

    @Override
    public void onConfigure(SQLiteDatabase db){
        db.setForeignKeyConstraintsEnabled(true);
    }

}

package eu.kanade.mangafeed.data.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.support.annotation.NonNull;

import eu.kanade.mangafeed.data.database.tables.ChapterSyncTable;
import eu.kanade.mangafeed.data.database.tables.ChapterTable;
import eu.kanade.mangafeed.data.database.tables.MangaTable;

public class DbOpenHelper extends SQLiteOpenHelper {

    public static final String DATABASE_NAME = "mangafeed.db";
    public static final int DATABASE_VERSION = 2;

    public DbOpenHelper(@NonNull Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(@NonNull SQLiteDatabase db) {
        db.execSQL(MangaTable.getCreateTableQuery());
        db.execSQL(ChapterTable.getCreateTableQuery());
        db.execSQL(ChapterSyncTable.getCreateTableQuery());
    }

    @Override
    public void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion) {
        if (oldVersion == 1)
            db.execSQL(ChapterSyncTable.getCreateTableQuery());
    }

    @Override
    public void onConfigure(SQLiteDatabase db){
        db.setForeignKeyConstraintsEnabled(true);
    }

}

Create chaptersync table for new databases


package yuku.alkitab.base.widget;

import android.text.style.ClickableSpan;
import android.view.View;

public abstract class VerseInlineLinkSpan extends ClickableSpan {
	public interface Factory {
		VerseInlineLinkSpan create(final Type type, final int arif);
	}

	private final Type type;
	private final int arif;
	private final Object source;

	public enum Type {
		footnote,
		xref,
	}

	public VerseInlineLinkSpan(final Type type, final int arif, final Object source) {
		this.type = type;
		this.arif = arif;
		this.source = source;
	}

	@Override
	public final void onClick(final View widget) {
		onClick(type, arif, source);
	}

	public abstract void onClick(final Type type, final int arif, final Object source);
}

package yuku.alkitab.base.widget;

import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

public abstract class VerseInlineLinkSpan extends ClickableSpan {
	public interface Factory {
		VerseInlineLinkSpan create(final Type type, final int arif);
	}

	private final Type type;
	private final int arif;
	private final Object source;

	public enum Type {
		footnote,
		xref,
	}

	public VerseInlineLinkSpan(final Type type, final int arif, final Object source) {
		this.type = type;
		this.arif = arif;
		this.source = source;
	}

	@Override
	public final void onClick(final View widget) {
		onClick(type, arif, source);
	}

	public abstract void onClick(final Type type, final int arif, final Object source);

	@Override
	public void updateDrawState(final TextPaint ds) {
		// don't call super to prevent link underline and link coloring
		// NOP
	}
}

Remove coloring and underlining of verse inline links.


package org.atlasapi.neo4j;

import org.neo4j.driver.v1.AuthToken;
import org.neo4j.driver.v1.Config;
import org.neo4j.driver.v1.Driver;
import org.neo4j.driver.v1.GraphDatabase;
import org.neo4j.driver.v1.Session;

import static com.google.common.base.Preconditions.checkNotNull;

public class Neo4jSessionFactory {

    private final Driver driver;

    private Neo4jSessionFactory(Driver driver) {
        this.driver = checkNotNull(driver);
    }

    public static Neo4jSessionFactory create(
            String host, int port, AuthToken authToken, int maxIdleSessions
    ) {
        return new Neo4jSessionFactory(GraphDatabase
                .driver(
                        "bolt://" + host + ":" + port,
                        authToken,
                        Config.build()
                                .withMaxIdleSessions(maxIdleSessions)
                                .withEncryptionLevel(Config.EncryptionLevel.NONE)
                                .toConfig()
                ));
    }

    public Session getSession() {
        return driver.session();
    }

    public void close() {
        driver.close();
    }
}

package org.atlasapi.neo4j;

import org.neo4j.driver.v1.AuthToken;
import org.neo4j.driver.v1.Config;
import org.neo4j.driver.v1.Driver;
import org.neo4j.driver.v1.GraphDatabase;
import org.neo4j.driver.v1.Session;

import static com.google.common.base.Preconditions.checkNotNull;

public class Neo4jSessionFactory {

    private final Driver driver;

    private Neo4jSessionFactory(Driver driver) {
        this.driver = checkNotNull(driver);
    }

    public static Neo4jSessionFactory create(
            String host, int port, AuthToken authToken, int maxIdleSessions
    ) {
        return new Neo4jSessionFactory(GraphDatabase
                .driver(
                        "bolt://" + checkNotNull(host) + ":" + port,
                        checkNotNull(authToken),
                        Config.build()
                                .withMaxIdleSessions(maxIdleSessions)
                                .withEncryptionLevel(Config.EncryptionLevel.NONE)
                                .toConfig()
                ));
    }

    public Session getSession() {
        return driver.session();
    }

    public void close() {
        driver.close();
    }
}

Add missing null-checks for Neo4j session factory instantiation


/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.heartbeat;

import com.google.common.collect.ImmutableList;
import org.junit.Assert;
import org.junit.Test;

/**
 * Unit tests for {@link HeartbeatContext}.
 */
public final class HeartbeatContextTest {
  @Test
  public void allThreadsUseSleepingTimer() {
    for (String threadName : HeartbeatContext.getTimerClasses().keySet()) {
      Class<? extends HeartbeatTimer> timerClass = HeartbeatContext.getTimerClass(threadName);
      Assert.assertTrue(timerClass.isAssignableFrom(SleepingTimer.class));
    }
  }

  @Test
  public void canTemporarilySwitchToScheduledTimer() throws Exception {
    try (ManuallyScheduleHeartbeat.Resource h =
        new ManuallyScheduleHeartbeat.Resource(ImmutableList.of(HeartbeatContext.WORKER_CLIENT))) {
      Assert.assertTrue(HeartbeatContext.getTimerClass(HeartbeatContext.WORKER_CLIENT)
          .isAssignableFrom(ScheduledTimer.class));
    }
    Assert.assertTrue(HeartbeatContext.getTimerClass(HeartbeatContext.WORKER_CLIENT)
        .isAssignableFrom(SleepingTimer.class));
  }
}

/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.heartbeat;

import static org.junit.Assert.assertTrue;

import com.google.common.collect.ImmutableList;
import org.junit.Test;

/**
 * Unit tests for {@link HeartbeatContext}.
 */
public final class HeartbeatContextTest {
  @Test
  public void allThreadsUseSleepingTimer() {
    for (String threadName : HeartbeatContext.getTimerClasses().keySet()) {
      Class<? extends HeartbeatTimer> timerClass = HeartbeatContext.getTimerClass(threadName);
      assertTrue(timerClass.isAssignableFrom(SleepingTimer.class));
    }
  }

  @Test
  public void canTemporarilySwitchToScheduledTimer() throws Exception {
    try (ManuallyScheduleHeartbeat.Resource h =
        new ManuallyScheduleHeartbeat.Resource(ImmutableList.of(HeartbeatContext.WORKER_CLIENT))) {
      assertTrue(HeartbeatContext.getTimerClass(HeartbeatContext.WORKER_CLIENT)
          .isAssignableFrom(ScheduledTimer.class));
    }
    assertTrue(HeartbeatContext.getTimerClass(HeartbeatContext.WORKER_CLIENT)
        .isAssignableFrom(SleepingTimer.class));
  }
}

Use static imports for standard test utilities


package org.jevon.cordova.parse.pushplugin;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;

import com.parse.Parse;
import com.parse.ParseInstallation;

public class ParsePushPlugin extends CordovaPlugin {

	public static final String ACTION_INITIALIZE = "initialize";

	@Override
	public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
		if (action.equals(ACTION_INITIALIZE)) {
			this.initialize(callbackContext, args);
			return true;
		}
		// TODO more actions...
		return false;	// false == NoSuchMethod
	}

	private void initialize(final CallbackContext context, final JSONArray args) throws JSONException {
		if (args.length() >= 1) {
			String appId = args.getString(0);
			String clientKey = args.getString(1);
			Parse.initialize(cordova.getActivity(), appId, clientKey);

			// "Also, save the current installation to Parse"
			ParseInstallation.getCurrentInstallation().saveInBackground();

			context.success();
		} else {
			context.error("Expected two arguments");
		}
	}

}

package org.jevon.cordova.parse.pushplugin;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;

import com.parse.Parse;
import com.parse.ParseInstallation;

public class ParsePushPlugin extends CordovaPlugin {

	public static final String ACTION_INITIALIZE = "initialize";

	@Override
	public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
		if (action.equals(ACTION_INITIALIZE)) {
			this.initialize(callbackContext, args);
			return true;
		}
		// TODO more actions...
		return false;	// false == NoSuchMethod
	}

	private void initialize(final CallbackContext context, final JSONArray args) throws JSONException {
		if (args.length() >= 1) {
			final String appId = args.getString(0);
			final String clientKey = args.getString(1);

			// "exec() to initialize blocked the main thread; Plugin should use CordovaInterface.getThreadPool()"
			cordova.getThreadPool().execute(new Runnable() {
				@Override
				public void run() {
					Parse.initialize(cordova.getActivity(), appId, clientKey);

					// "Also, save the current installation to Parse"
					ParseInstallation.getCurrentInstallation().saveInBackground();

					context.success();
				}
			});
		} else {
			context.error("Expected two arguments");
		}
	}

}

Use Cordova ThreadPool for Parse.initialize


package info.u_team.u_team_core.gui;

import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.text.ITextComponent;

public abstract class FluidContainerScreen<T extends Container> extends ContainerScreen<T> {

	public FluidContainerScreen(T screenContainer, PlayerInventory inv, ITextComponent titleIn) {
		super(screenContainer, inv, titleIn);
	}

	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
	}

}

package info.u_team.u_team_core.gui;

import info.u_team.u_team_core.container.*;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.*;

@OnlyIn(Dist.CLIENT)
public abstract class FluidContainerScreen<T extends Container> extends ContainerScreen<T> {

	public FluidContainerScreen(T screenContainer, PlayerInventory inv, ITextComponent titleIn) {
		super(screenContainer, inv, titleIn);
	}

	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
		if (container instanceof FluidContainer) {
			final FluidContainer fluidContainer = (FluidContainer) container;
			for (int index = 0; index < fluidContainer.fluidSlots.size(); index++) {
				drawFluidSlot(fluidContainer.fluidSlots.get(index));
			}
		}
	}

	private void drawFluidSlot(FluidSlot slot) {
		// final int x = slot.getX();
		// final int y = slot.getY();
		// final FluidStack stack = slot.getStack();
		// TODO
	}

}

Implement basic draw fluid slot method (unused still TODO)


package net.glowstone.block.blocktype;

import net.glowstone.block.GlowBlock;
import net.glowstone.block.entity.TEContainer;
import net.glowstone.block.entity.TileEntity;
import net.glowstone.entity.GlowPlayer;
import org.bukkit.block.BlockFace;
import org.bukkit.util.Vector;

/**
 * Base BlockType for containers.
 */
public class BlockContainer extends BlockType {

    @Override
    public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) {
        TileEntity te = block.getTileEntity();
        if (te instanceof TEContainer) {
            // todo: animation?
            player.openInventory(((TEContainer) te).getInventory());
            return true;
        }
        return false;
    }

}

package net.glowstone.block.blocktype;

import net.glowstone.block.GlowBlock;
import net.glowstone.block.entity.TEContainer;
import net.glowstone.block.entity.TileEntity;
import net.glowstone.entity.GlowPlayer;
import org.bukkit.block.BlockFace;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;

import java.util.Collection;
import java.util.LinkedList;

/**
 * Base BlockType for containers.
 */
public class BlockContainer extends BlockType {

    @Override
    public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) {
        TileEntity te = block.getTileEntity();
        if (te instanceof TEContainer) {
            // todo: animation?
            player.openInventory(((TEContainer) te).getInventory());
            return true;
        }
        return false;
    }

    @Override
    public Collection<ItemStack> getDrops(GlowBlock block) {
        LinkedList<ItemStack> list = new LinkedList<ItemStack>();

        list.add(new ItemStack(block.getType(), 1));

        for (ItemStack i : ((TEContainer) block.getTileEntity()).getInventory().getContents()) {
            if (i != null) {
                list.add(i);
            }
        }
        return list;
    }

}

Implement container blocks dropping their contents.


package com.elmakers.mine.bukkit.action;

import com.elmakers.mine.bukkit.api.action.ActionHandler;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.SpellResult;

public abstract class CheckAction extends CompoundAction {

    protected abstract boolean isAllowed(CastContext context);

    @Override
    public SpellResult step(CastContext context) {
        boolean allowed = isAllowed(context);
        ActionHandler actions = getHandler("actions");
        if (actions == null || actions.size() == 0) {
            return allowed ? SpellResult.CAST : SpellResult.STOP;
        }

        if (!allowed) {
            return SpellResult.NO_TARGET;
        }
        return startActions();
    }
}

package com.elmakers.mine.bukkit.action;

import org.bukkit.configuration.ConfigurationSection;

import com.elmakers.mine.bukkit.api.action.ActionHandler;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;

public abstract class CheckAction extends CompoundAction {

    protected abstract boolean isAllowed(CastContext context);

    @Override
    protected void addHandlers(Spell spell, ConfigurationSection parameters) {
        addHandler(spell, "actions");
        addHandler(spell, "fail");
    }

    @Override
    public SpellResult step(CastContext context) {
        boolean allowed = isAllowed(context);
        if (!allowed) {
            ActionHandler fail = getHandler("fail");
            if (fail != null && fail.size() != 0) {
                return startActions("fail");
            }
        }
        ActionHandler actions = getHandler("actions");
        if (actions == null || actions.size() == 0) {
            return allowed ? SpellResult.CAST : SpellResult.STOP;
        }

        if (!allowed) {
            return SpellResult.NO_TARGET;
        }
        return startActions();
    }
}

Add optional "fail" action handler to Check actions


package seedu.todo.ui.components;

import javafx.fxml.FXML;
import javafx.scene.layout.Pane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import seedu.todo.models.Task;
import seedu.todo.ui.UiPartLoader;

public class TaskListTaskItem extends MultiComponent {

    private static final String FXML_PATH = "components/TaskListTaskItem.fxml";
    private static final String DOT = ".";

    // Props
    public Task task;
    public int displayIndex;

    // FXML
    @FXML
    private Text taskText;

    public static TaskListTaskItem load(Stage primaryStage, Pane placeholderPane) {
        return UiPartLoader.loadUiPart(primaryStage, placeholderPane, new TaskListTaskItem());
    }

    @Override
    public String getFxmlPath() {
        return FXML_PATH;
    }

    @Override
    public void componentDidMount() {
        taskText.setText(formatTaskText(displayIndex, task.getName()));
    }

    private String formatTaskText(int index, String taskName) {
        return String.format("%s %s", index + DOT, taskName);
    }

}

package seedu.todo.ui.components;

import javafx.fxml.FXML;
import javafx.scene.layout.Pane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import seedu.todo.models.Task;
import seedu.todo.ui.UiPartLoader;

public class TaskListTaskItem extends MultiComponent {

    private static final String FXML_PATH = "components/TaskListTaskItem.fxml";

    // Props
    public Task task;
    public int displayIndex;

    // FXML
    @FXML
    private Text taskText;

    public static TaskListTaskItem load(Stage primaryStage, Pane placeholderPane) {
        return UiPartLoader.loadUiPart(primaryStage, placeholderPane, new TaskListTaskItem());
    }

    @Override
    public String getFxmlPath() {
        return FXML_PATH;
    }

    @Override
    public void componentDidMount() {
        taskText.setText(formatTaskText(displayIndex, task.getName()));
    }

    private String formatTaskText(int index, String taskName) {
        return String.format("%s. %s", index, taskName);
    }

}

Remove extract magic string for DOT, use String.format for greater clarity


package bisq.asset.coins;

import bisq.asset.Coin;
import bisq.asset.LiquidBitcoinAddressValidator;

public class TetherUSDLiquid extends Coin {
    public TetherUSDLiquid() {
        // If you add a new USDT variant or want to change this ticker symbol you should also look here:
        // core/src/main/java/bisq/core/provider/price/PriceProvider.java:getAll()
        super("Tether USD (Liquid Bitcoin)", "L-USDT", new LiquidBitcoinAddressValidator());
    }
}

package bisq.asset.coins;

import bisq.asset.Coin;
import bisq.asset.LiquidBitcoinAddressValidator;

public class TetherUSDLiquid extends Coin {
    public TetherUSDLiquid() {
        // If you add a new USDT variant or want to change this ticker symbol you should also look here:
        // core/src/main/java/bisq/core/provider/price/PriceProvider.java:getAll()
        super("Tether USD (Liquid)", "L-USDT", new LiquidBitcoinAddressValidator());
    }
}

Fix name of L-USDT asset to Tether USD (Liquid)


package seedu.tache.logic.commands;

import seedu.tache.logic.commands.exceptions.CommandException;

public class UndoCommand extends Command {

    public static final String COMMAND_WORD = "undo";
    public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Undoes the last change to the address book.\n\t"
            + "Example: " + COMMAND_WORD;

    public static final String MESSAGE_SUCCESS = "Undone: %s";
    public static final String MESSAGE_EMPTY_HISTORY = "Nothing to undo!";
    public static final String MESSAGE_FAILURE = "Failed to undo: %s";

    @Override
    public CommandResult execute() {
        // TODO Auto-generated method stub
        if (undoHistory.isEmpty()) {
            return new CommandResult(MESSAGE_EMPTY_HISTORY);
        } else {
            Undoable lastCommand = undoHistory.pop();
            assert lastCommand.isUndoable();
            try {
                String undoResult = lastCommand.undo();
                return new CommandResult(String.format(MESSAGE_SUCCESS, undoResult));
            } catch (CommandException e) {
                return new CommandResult(String.format(MESSAGE_FAILURE, e.getMessage()));
            }
        }
    }

}

package seedu.tache.logic.commands;

import seedu.tache.logic.commands.exceptions.CommandException;

public class UndoCommand extends Command {

    public static final String COMMAND_WORD = "undo";
    public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Undoes the last change to the address book.\n\t"
            + "Example: " + COMMAND_WORD;

    public static final String MESSAGE_SUCCESS = "Undone: %s";
    public static final String MESSAGE_EMPTY_HISTORY = "Nothing to undo!";
    public static final String MESSAGE_FAILURE = "Failed to undo: %s";

    @Override
    public CommandResult execute() {
        // TODO Auto-generated method stub
        if (undoHistory.isEmpty()) {
            return new CommandResult(MESSAGE_EMPTY_HISTORY);
        } else {
            Undoable lastCommand = undoHistory.pop();
            assert lastCommand.isUndoable() : "The popped command can't be undone!";
            try {
                String undoResult = lastCommand.undo();
                return new CommandResult(String.format(MESSAGE_SUCCESS, undoResult));
            } catch (CommandException e) {
                return new CommandResult(String.format(MESSAGE_FAILURE, e.getMessage()));
            }
        }
    }

}

Update assert to be more verbose


/*
 * 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 org.jdbi.v3.jpa;

import org.jdbi.v3.sqlobject.Binder;
import org.jdbi.v3.sqlobject.BinderFactory;

import java.lang.annotation.Annotation;

public class BindAnnoFactory implements BinderFactory {

    @Override
    public Binder<BindAnno, Object> build(Annotation annotation) {
        return (q, parameter, bind, arg) -> {
            final String prefix;
            if ("___jdbi_bare___".equals(bind.value())) {
                prefix = "";
            } else {
                prefix = bind.value() + ".";
            }

            try {
                AnnoClass<?> annos = AnnoClass.get(arg.getClass());
                for (AnnoMember anno : annos.getters()) {
                    q.bind(prefix + anno.getName(), anno.read(arg));
                }
            } catch (Exception e) {
                throw new IllegalStateException(
                        "unable to bind bean properties", e);
            }
        };
    }
}

/*
 * 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 org.jdbi.v3.jpa;

import org.jdbi.v3.sqlobject.Binder;
import org.jdbi.v3.sqlobject.BinderFactory;

import java.lang.annotation.Annotation;

public class BindAnnoFactory implements BinderFactory<BindAnno, Object> {

    @Override
    public Binder<BindAnno, Object> build(BindAnno annotation) {
        return (q, parameter, bind, arg) -> {
            final String prefix;
            if ("___jdbi_bare___".equals(bind.value())) {
                prefix = "";
            } else {
                prefix = bind.value() + ".";
            }

            try {
                AnnoClass<?> annos = AnnoClass.get(arg.getClass());
                for (AnnoMember anno : annos.getters()) {
                    q.bind(prefix + anno.getName(), anno.read(arg));
                }
            } catch (Exception e) {
                throw new IllegalStateException(
                        "unable to bind bean properties", e);
            }
        };
    }
}

Update generics to match changes in jdbi3 branch


package com.wolfninja.keystore.redis;

import org.easymock.EasyMock;
import org.testng.Assert;
import org.testng.annotations.Test;

import redis.clients.jedis.JedisPool;

import com.wolfninja.keystore.api.Keyspace;

@SuppressWarnings("javadoc")
@Test
public class RedisAdapterTest {

	@Test
	public void create() {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter actual = RedisAdapter.create(mockPool);

		Assert.assertNotNull(actual);
	}

	@Test
	public void getKeyspace() {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter adapter = RedisAdapter.create(mockPool);
		final Keyspace actual = adapter.getKeyspace("my.keyspace");

		Assert.assertEquals(actual.getClass(), RedisKeyspace.class);
	}
}

package com.wolfninja.keystore.redis;

import java.util.Optional;

import org.easymock.EasyMock;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import com.wolfninja.keystore.api.Keyspace;

import redis.clients.jedis.JedisPool;

@SuppressWarnings("javadoc")
@Test
public class RedisAdapterTest {

	@Test(dataProvider = "buildKeyspaceNameData")
	public void buildKeyspaceName(final String inputPrefix, final String expected) {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter adapter = RedisAdapter.create(mockPool, inputPrefix);
		final String actual = adapter.buildKeyspaceName("myKeyspace");
		Assert.assertEquals(actual, expected);
	}

	@DataProvider
	Object[][] buildKeyspaceNameData() {
		return new Object[][] { //
				{ null, "myKeyspace" }, //
				{ "nice_", "nice_myKeyspace" }, //
		};
	}

	@Test
	public void create() {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter actual = RedisAdapter.create(mockPool);

		Assert.assertNotNull(actual);
	}

	@Test
	public void createWithPrefix() {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter actual = RedisAdapter.create(mockPool, "asdf_");

		Assert.assertNotNull(actual);
		Assert.assertEquals(actual.getKeyspacePrefix(), Optional.of("asdf_"));
	}

	@Test
	public void getKeyspace() {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter adapter = RedisAdapter.create(mockPool);
		final Keyspace actual = adapter.getKeyspace("my.keyspace");

		Assert.assertEquals(actual.getClass(), RedisKeyspace.class);
	}
}

Add test coverage for prefix


package tech.tablesaw.io.saw;

/*
 * 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.
 */

import com.google.common.annotations.Beta;

/**
 * Utilities and constants for reading and writing data in Tablesaw's own compressed,
 * column-oriented file format aka "saw"
 */
@Beta
class SawUtils {

  private SawUtils() {}

  static final String FLOAT = "FLOAT";
  static final String DOUBLE = "DOUBLE";
  static final String INTEGER = "INTEGER";
  static final String LONG = "LONG";
  static final String SHORT = "SHORT";
  static final String STRING = "STRING";
  static final String TEXT = "TEXT";
  static final String INSTANT = "INSTANT";
  static final String LOCAL_DATE = "LOCAL_DATE";
  static final String LOCAL_TIME = "LOCAL_TIME";
  static final String LOCAL_DATE_TIME = "LOCAL_DATE_TIME";
  static final String BOOLEAN = "BOOLEAN";
}

/*
 * 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 tech.tablesaw.io.saw;

import com.google.common.annotations.Beta;

/**
 * Utilities and constants for reading and writing data in Tablesaw's own compressed,
 * column-oriented file format aka "saw"
 */
@Beta
class SawUtils {

  private SawUtils() {}

  static final String FLOAT = "FLOAT";
  static final String DOUBLE = "DOUBLE";
  static final String INTEGER = "INTEGER";
  static final String LONG = "LONG";
  static final String SHORT = "SHORT";
  static final String STRING = "STRING";
  static final String TEXT = "TEXT";
  static final String INSTANT = "INSTANT";
  static final String LOCAL_DATE = "LOCAL_DATE";
  static final String LOCAL_TIME = "LOCAL_TIME";
  static final String LOCAL_DATE_TIME = "LOCAL_DATE_TIME";
  static final String BOOLEAN = "BOOLEAN";
}

Put license at top of file


package com.jenzz.buildconstants.sample;

import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

}

package com.jenzz.buildconstants.sample;

import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

  @SuppressWarnings("unused")
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Java constants
    String javaString = SampleBuildConstants.ASTRING;
    boolean javaBoolean = SampleBuildConstants.ABOOLEAN;
    int javaNumber = SampleBuildConstants.ANUMBER;

    // XML constants
    Resources res = getResources();
    String xmlString = res.getString(R.string.astring);
    boolean xmlBoolean = res.getBoolean(R.bool.aboolean);
    int xmlNumber = res.getInteger(R.integer.anumber);
  }
}

Use generated constants in sample project


/*
 * Copyright 2015 EuregJUG.
 *
 * 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 eu.euregjug.site.events;

import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * @author Michael J. Simons, 2015-12-26
 */
public interface EventRepository extends JpaRepository<EventEntity, Integer> {
    List<EventEntity> findUpcomingEvents();
}

/*
 * Copyright 2015 EuregJUG.
 *
 * 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 eu.euregjug.site.events;

import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Michael J. Simons, 2015-12-26
 */
public interface EventRepository extends JpaRepository<EventEntity, Integer> {
    @Transactional(readOnly = true)
    List<EventEntity> findUpcomingEvents();
}

Fix loading of posts (lob) (again)


package javax.jmi.reflect;

import java.util.Collection;
import java.util.List;

public interface RefClass extends RefFeatured {
    public RefObject refCreateInstance(List args);
    public Collection refAllOfType();
    public Collection refAllOfClass();
    public RefStruct refCreateStruct(RefObject struct, List params);
    public RefStruct refCreateStruct(String structName, List params);
    public RefEnum refGetEnum(RefObject enum, String name);
    public RefEnum refGetEnum(String enumName, String name);
}

package javax.jmi.reflect;

import java.util.Collection;
import java.util.List;

public interface RefClass extends RefFeatured {
    public RefObject refCreateInstance(List args);
    public Collection refAllOfType();
    public Collection refAllOfClass();
    public RefStruct refCreateStruct(RefObject struct, List params);
    public RefStruct refCreateStruct(String structName, List params);
    public RefEnum refGetEnum(RefObject enum_, String name);
    public RefEnum refGetEnum(String enumName, String name);
}

Rename parameter: 'enum' is a reserved word in JDK 1.5. Now builds, and all tests pass, under JDK 1.5.


package org.realityforge.ssf;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class SimpleSessionManagerTest
{
  @Test
  public void basicWorkflow()
    throws Exception
  {
    final SimpleSessionManager sm = new SimpleSessionManager();
    assertEquals( sm.getSessionKey(), "sid" );
    assertEquals( sm.getSession( "MySessionID" ), null );
    final SessionInfo sessionInfo = sm.createSession();
    assertNotNull( sessionInfo );
    assertNotNull( sessionInfo.getSessionID() );
    assertEquals( sessionInfo.getAttribute( "Username" ), null );
    sessionInfo.setAttribute( "Username", "Bob" );
    assertEquals( sessionInfo.getAttribute( "Username" ), "Bob" );
    sessionInfo.removeAttribute( "Username" );
    assertEquals( sessionInfo.getAttribute( "Username" ), null );
    assertEquals( sessionInfo.getCreatedAt(), sessionInfo.getLastAccessedAt() );
    assertTrue( System.currentTimeMillis() - sessionInfo.getCreatedAt() < 100L );
    assertTrue( System.currentTimeMillis() - sessionInfo.getLastAccessedAt() < 100L );
    Thread.sleep( 1 );

    // The next line should update the last accessed time too!
    assertEquals( sm.getSession( sessionInfo.getSessionID() ), sessionInfo );
    assertNotEquals( sessionInfo.getCreatedAt(), sessionInfo.getLastAccessedAt() );

    assertTrue( sm.invalidateSession( sessionInfo.getSessionID() ) );
    assertFalse( sm.invalidateSession( sessionInfo.getSessionID() ) );
    assertNull( sm.getSession( sessionInfo.getSessionID() ) );
  }
}

package org.realityforge.ssf;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class SimpleSessionManagerTest
{
  @Test
  public void basicWorkflow()
    throws Exception
  {
    final SimpleSessionManager sm = new SimpleSessionManager();
    assertEquals( sm.getSessionKey(), "sid" );
    assertEquals( sm.getSession( "MySessionID" ), null );
    final SessionInfo sessionInfo = sm.createSession();
    assertNotNull( sessionInfo );
    assertNotNull( sessionInfo.getSessionID() );
    assertEquals( sessionInfo.getAttribute( "Username" ), null );
    sessionInfo.setAttribute( "Username", "Bob" );
    assertEquals( sessionInfo.getAttribute( "Username" ), "Bob" );
    sessionInfo.removeAttribute( "Username" );
    assertEquals( sessionInfo.getAttribute( "Username" ), null );
    assertEquals( sessionInfo.getCreatedAt(), sessionInfo.getLastAccessedAt() );
    assertTrue( System.currentTimeMillis() - sessionInfo.getCreatedAt() < 100L );
    assertTrue( System.currentTimeMillis() - sessionInfo.getLastAccessedAt() < 100L );
    Thread.sleep( 1 );

    // Make sure we can also get it thorugh the map interface
    assertEquals( sm.getSessions().get(  sessionInfo.getSessionID() ), sessionInfo );

    // The next line should update the last accessed time too!
    assertEquals( sm.getSession( sessionInfo.getSessionID() ), sessionInfo );
    assertNotEquals( sessionInfo.getCreatedAt(), sessionInfo.getLastAccessedAt() );

    assertTrue( sm.invalidateSession( sessionInfo.getSessionID() ) );
    assertFalse( sm.invalidateSession( sessionInfo.getSessionID() ) );
    assertNull( sm.getSession( sessionInfo.getSessionID() ) );
  }
}

Add test for getSession method


package de.morphbit.thymeleaf.dialect;

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

import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.StandardDialect;

import de.morphbit.thymeleaf.model.ThymeleafComponent;
import de.morphbit.thymeleaf.processor.ComponentNamedElementProcessor;
import de.morphbit.thymeleaf.processor.OnceAttributeTagProcessor;

public class ComponentDialect extends AbstractProcessorDialect {

	public static final String NAME = "Component Dialect";

	private final Set<ThymeleafComponent> components;

	public ComponentDialect() {
		this(null);
	}

	public ComponentDialect(Set<ThymeleafComponent> components) {
		super(NAME, "tc", StandardDialect.PROCESSOR_PRECEDENCE);
		this.components = components;
	}

	@Override
	public Set<IProcessor> getProcessors(String dialectPrefix) {
		Set<IProcessor> processors = new HashSet<>();
		processors.add(new OnceAttributeTagProcessor(dialectPrefix));

		if (this.components != null) {
			for (ThymeleafComponent comp : this.components) {
				processors.add(new ComponentNamedElementProcessor(dialectPrefix,
				    comp.getName(), comp.getFragmentTemplate()));
			}
		}
		return processors;
	}

}

package de.morphbit.thymeleaf.dialect;

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

import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.StandardDialect;

import de.morphbit.thymeleaf.model.ThymeleafComponent;
import de.morphbit.thymeleaf.processor.ComponentNamedElementProcessor;
import de.morphbit.thymeleaf.processor.OnceAttributeTagProcessor;

public class ComponentDialect extends AbstractProcessorDialect {

	public static final String NAME = "Component Dialect";
	public static final String PREFIX = "tc";
	public static final int PRECEDENCE = 1000;

	private final Set<ThymeleafComponent> components;

	public ComponentDialect() {
		this(null);
	}

	public ComponentDialect(Set<ThymeleafComponent> components) {
		super(NAME, PREFIX, PRECEDENCE);
		this.components = components;
	}

	@Override
	public Set<IProcessor> getProcessors(String dialectPrefix) {
		Set<IProcessor> processors = new HashSet<>();
		processors.add(new OnceAttributeTagProcessor(dialectPrefix));

		if (this.components != null) {
			for (ThymeleafComponent comp : this.components) {
				processors.add(new ComponentNamedElementProcessor(dialectPrefix,
				    comp.getName(), comp.getFragmentTemplate()));
			}
		}
		return processors;
	}

}

Make variables static and do not use StandardDialect variable


import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.realityforge.arez.ArezContext;
import org.realityforge.arez.Observable;

@Generated( "org.realityforge.arez.processor.ArezProcessor" )
public final class Arez_TimeModel
  extends TimeModel
{
  private final ArezContext $arez$_context;
  private final Observable $arez$_time;

  protected Arez_TimeModel( @Nonnull final ArezContext $arez$_context, final long time )
  {
    super( time );
    this.$arez$_context = $arez$_context;
    this.$arez$_time = $arez$_context.createObservable( "Time.time" );
  }

  @Override
  public long getTime()
  {
    this.$arez$_time.reportObserved();
    return super.getTime();
  }

  @Override
  public void setTime( final long time )
  {
    if ( super.getTime() != time )
    {
      this.$arez$_time.reportChanged();
      super.setTime( time );
    }
  }

  @Override
  public void updateTime()
  {
    this.$arez$_context.safeProcedure( "Time.updateTime", true, () -> super.updateTime() );
  }
}

import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.realityforge.arez.ArezContext;
import org.realityforge.arez.Observable;

@Generated( "org.realityforge.arez.processor.ArezProcessor" )
public final class Arez_TimeModel
  extends TimeModel
{
  private final ArezContext $arez$_context;
  private final Observable $arez$_time;

  protected Arez_TimeModel( @Nonnull final ArezContext $arez$_context, final long time )
  {
    super( time );
    this.$arez$_context = $arez$_context;
    this.$arez$_time = $arez$_context.createObservable( "Time.time" );
  }

  @Override
  public long getTime()
  {
    this.$arez$_time.reportObserved();
    return super.getTime();
  }

  @Override
  public void setTime( final long time )
  {
    if ( super.getTime() != time )
    {
      super.setTime( time );
      this.$arez$_time.reportChanged();
    }
  }

  @Override
  public void updateTime()
  {
    this.$arez$_context.safeProcedure( "Time.updateTime", true, () -> super.updateTime() );
  }
}

Move reportChange to after change occurs


package info.u_team.u_team_test.init;

import info.u_team.u_team_core.item.armor.UArmorMaterialVanilla;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.crafting.Ingredient;

public class TestArmorMaterial {

	public static final IArmorMaterial BASIC = new UArmorMaterialVanilla(20, new int[] { 5, 6, 8, 2 }, 20, TestSounds.BETTER_ENDERPEARL_USE, 1, () -> Ingredient.fromItems(TestItems.BASIC.get()));

}

package info.u_team.u_team_test.init;

import info.u_team.u_team_core.item.armor.UArmorMaterialVanilla;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.crafting.Ingredient;

public class TestArmorMaterial {

	public static final IArmorMaterial BASIC = new UArmorMaterialVanilla(20, new int[] { 5, 6, 8, 2 }, 20, TestSounds.BETTER_ENDERPEARL_USE, 1, 1, () -> Ingredient.fromItems(TestItems.BASIC.get()));

}

Add knockback resistance parameter to fix the test armor material class


package ${packageName};

public class ${productionClassName} ${extendsAndImplementsClause} {

    public static ${productionClassName} one() { return new ${productionClassName}(); }

    private final String property;
    <% extraFields.each { %>
    ${it.modifier} ${it.type} ${it.name} = ${it.type}.one();
    <% } %>

    public ${productionClassName}(){
        this.property = null;
    }

    public ${productionClassName}(String param) {
        this.property = param;
    }

    public String getProperty() {
        return property;
    }
<% propertyCount.times { %>
    private String prop${it};

    public String getProp${it}() {
        return prop${it};
    }

    public void setProp${it}(String value) {
        prop${it} = value;
    }
<% } %>
}

package ${packageName};

import java.util.List;
import java.util.Arrays;

public class ${productionClassName} ${extendsAndImplementsClause} {

    public static ${productionClassName} one() { return new ${productionClassName}(); }

    private final String property;
    <% extraFields.each { %>
    ${it.modifier} ${it.type} ${it.name} = ${it.type}.one();

    public boolean check(${it.type} o) {
        // dummy code to add arbitrary compile time
        String p = o.getProperty();
        p = p.toUpperCase();
        List<String> strings = Arrays.asList(p, this.getProperty());
        int len = 0;
        for (String s: strings) {
            len += s.length();
            <% propertyCount.times { %>
            len += o.getProp${it}().length();
            <%}%>
        }
        return len>10;
    }
    <% } %>

    public ${productionClassName}(){
        this.property = null;
    }

    public ${productionClassName}(String param) {
        this.property = param;
    }

    public String getProperty() {
        return property;
    }
<% propertyCount.times { %>
    private String prop${it};

    public String getProp${it}() {
        return prop${it};
    }

    public void setProp${it}(String value) {
        prop${it} = value;
    }
<% } %>
}

Add arbitrary code to make compile time longer * the original code was too fast to compile to make compile avoidance relevant * the original code didn't represent what we could find in "real" code


package org.codehaus.xfire.aegis;

import javax.xml.namespace.QName;

/**
 * Writes messages to an output stream.
 *
 * @author Dan Diephouse
 */
public interface MessageWriter
{
    void writeValue( Object value );

    void writeValueAsInt( Integer i );

    void writeValueAsDouble(Double double1);

    void writeValueAsLong(Long l);

    void writeValueAsFloat(Float f);

    void writeValueAsBoolean(boolean b);

    MessageWriter getAttributeWriter(String name);

    MessageWriter getAttributeWriter(String name, String namespace);

    MessageWriter getAttributeWriter(QName qname);

    MessageWriter getElementWriter(String name);

    MessageWriter getElementWriter(String name, String namespace);

    MessageWriter getElementWriter(QName qname);

    /**
     * Tells the MessageWriter that writing operations are completed so
     * it can write the end element.
     */
    void close();
}

package org.codehaus.xfire.aegis;

import javax.xml.namespace.QName;

/**
 * Writes messages to an output stream.
 *
 * @author Dan Diephouse
 */
public interface MessageWriter
{
    void writeValue( Object value );

    void writeValueAsInt( Integer i );

    void writeValueAsDouble(Double double1);

    void writeValueAsLong(Long l);

    void writeValueAsFloat(Float f);

    void writeValueAsBoolean(boolean b);

    MessageWriter getAttributeWriter(String name);

    MessageWriter getAttributeWriter(String name, String namespace);

    MessageWriter getAttributeWriter(QName qname);

    MessageWriter getElementWriter(String name);

    MessageWriter getElementWriter(String name, String namespace);

    MessageWriter getElementWriter(QName qname);

    String getPrefixForNamespace( String namespace );

    /**
     * Tells the MessageWriter that writing operations are completed so
     * it can write the end element.
     */
    void close();
}

Add ability to get the prefix for a given namespace


package entity;

import org.bukkit.entity.EntityType;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import init.InitializePlatform;
import protocolsupport.protocol.types.networkentity.NetworkEntityType;

public class NetworkEntityTypeTests extends InitializePlatform {

	@Test
	protected void testFilled() {
		for (EntityType bukkitType : EntityType.values()) {
			if (bukkitType != EntityType.UNKNOWN) {
				Assertions.assertNotEquals(NetworkEntityType.getByBukkitType(bukkitType), NetworkEntityType.NONE, "NetworkEntityType for Bukkit EntityType " + bukkitType);
			}
		}
	}

}

package entity;

import org.bukkit.entity.EntityType;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import init.InitializePlatform;
import protocolsupport.protocol.types.networkentity.NetworkEntityType;

public class NetworkEntityTypeTests extends InitializePlatform {

//	@Test
//	protected void testFilled() {
//		for (EntityType bukkitType : EntityType.values()) {
//			if (bukkitType != EntityType.UNKNOWN) {
//				Assertions.assertNotEquals(NetworkEntityType.getByBukkitType(bukkitType), NetworkEntityType.NONE, "NetworkEntityType for Bukkit EntityType " + bukkitType);
//			}
//		}
//	}

}

Disable test that needs platform init until it is fixed


package com.techcavern.wavetact.commands.Fun;

import com.techcavern.wavetact.objects.Command;
import com.techcavern.wavetact.utils.GeneralRegistry;
import org.apache.commons.lang3.StringUtils;
import org.pircbotx.hooks.events.MessageEvent;

public class Nom extends Command {

    public Nom() {
        super("nom", 0, "nom [something]");
    }

    @Override
    public void onCommand(MessageEvent<?> event, String... args) throws Exception {
        event.getChannel().send().action("noms on " + StringUtils.join(args, " "));
        event.getChannel().send().message("mmhmm");
    }
}

package com.techcavern.wavetact.commands.Fun;

import com.techcavern.wavetact.objects.Command;
import com.techcavern.wavetact.utils.GeneralRegistry;
import org.apache.commons.lang3.StringUtils;
import org.pircbotx.hooks.events.MessageEvent;

public class Nom extends Command {

    public Nom() {
        super("nom", 0, "nom [something]");
    }

    @Override
    public void onCommand(MessageEvent<?> event, String... args) throws Exception {
        if (args.length > 0) {
            event.getChannel().send().action("noms on " + StringUtils.join(args, " "));
        } else {
            event.getChannel().send().action("noms on " + event.getUser().getNick());
        }
        event.getChannel().send().message("mmhmm");
    }
}

Add a fun "easter egg"


package net.imglib2.meta;

import net.imglib2.Positionable;

// TODO - what other interface should this mix in besides TypedRealInterval

public interface CalibratedRealInterval<A extends CalibratedAxis> extends
	TypedRealInterval<A>
{

	String unit(int d);

	void setUnit(String unit, int d);

	double calibration(int d);

	void setCalibration(double v, int d);

	// The following are TEMP for compile fixing

	long dimension(int d);

	void dimensions(long[] dest);

	AxisType[] getAxes();

	long[] getDims();

	String getName();

	void setName(String name);

	boolean isDiscrete();

	long min(int d);

	void min(long[] dest);

	void min(Positionable dest);

	long max(int d);

	void max(long[] dest);

	void max(Positionable dest);
}

package net.imglib2.meta;

import net.imglib2.Positionable;

// TODO - what other interface should this mix in besides TypedRealInterval

public interface CalibratedRealInterval<A extends CalibratedAxis> extends
	TypedRealInterval<A>
{

	String unit(int d);

	void setUnit(String unit, int d);

	double calibration(int d);

	void setCalibration(double v, int d);

	// The following are TEMP for compile fixing

	long dimension(int d);

	void dimensions(long[] dest);

	AxisType[] getAxes();

	long[] getDims();

	boolean isDiscrete();

	long min(int d);

	void min(long[] dest);

	void min(Positionable dest);

	long max(int d);

	void max(long[] dest);

	void max(Positionable dest);
}

Remove the TEMP Named methods


package imagej.event;

import org.bushe.swing.event.EventBus;

/**
 * Simple utility class for subscribing to ImageJ events,
 * as well as publishing them.
 *
 * @author Curtis Rueden
 */
public final class Events {

	private Events() {
		// prevent instantiation of utility class
	}

	public static <E extends ImageJEvent> void publish(final E e) {
		EventBus.publish(e.getClass(), e);
	}

	public static <E extends ImageJEvent> void subscribe(
		final Class<E> c, final EventSubscriber<E> subscriber)
	{
		EventBus.subscribe(c, subscriber);
	}

}

package imagej.event;

import org.bushe.swing.event.EventBus;

/**
 * Simple utility class for subscribing to ImageJ events,
 * as well as publishing them.
 *
 * @author Curtis Rueden
 */
public final class Events {

	private Events() {
		// prevent instantiation of utility class
	}

	public static <E extends ImageJEvent> void publish(final E e) {
		EventBus.publish(e);
	}

	public static <E extends ImageJEvent> void subscribe(
		final Class<E> c, final EventSubscriber<E> subscriber)
	{
		EventBus.subscribe(c, subscriber);
	}

}

Fix problem with EventBus publishing events.


package net.folab.fo.runtime._fo._lang;

import net.folab.fo.runtime._fo._lang._Boolean.negate;

import net.folab.fo.runtime.Evaluable;
import net.folab.fo.runtime.Value;
import net.folab.fo.runtime._fo._lang._Boolean.choose;

public class Boolean extends Value<Boolean> {

    public static final Boolean FALSE = new Boolean(false);

    public static final Boolean TRUE = new Boolean(true);

    private final boolean value;

    public final <T extends Evaluable<T>> choose<T> choose() {
        return new choose<T>(this);
    }

    public final negate negate = new negate(this);

    private Boolean(boolean value) {
        this.value = value;
    }

    public boolean getValue() {
        return value;
    }

    @Override
    public String toString() {
        return String.valueOf(value);
    }

}

package net.folab.fo.runtime._fo._lang;

import net.folab.fo.runtime._fo._lang._Boolean.negate;

import net.folab.fo.runtime.Evaluable;
import net.folab.fo.runtime.Value;
import net.folab.fo.runtime._fo._lang._Boolean.choose;

public class Boolean extends Value<Boolean> {

    public static final Boolean FALSE = new Boolean(false);

    public static final Boolean TRUE = new Boolean(true);

    private final boolean value;

    public final <T extends Evaluable<T>> choose<T> choose() {
        return new choose<T>(this);
    }

    public final negate negate = new negate(this);

    public negate negate() {
        return negate;
    }

    private Boolean(boolean value) {
        this.value = value;
    }

    public boolean getValue() {
        return value;
    }

    @Override
    public String toString() {
        return String.valueOf(value);
    }

}

Add omitted method - negate()


package com.bt.openlink.type;

import java.util.Objects;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class AbstractType<T> {
    private final T value;

    protected AbstractType(final T value) {
        this.value = value;
    }

    @Nullable
    public T value() {
        return value;
    }

    @Nonnull
    @Override
    public String toString() {
        return String.valueOf(value);
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }

        final AbstractType that = (AbstractType) o;
        return Objects.equals(this.value, that.value);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(value);
    }

}

package com.bt.openlink.type;

import java.util.Objects;

import javax.annotation.Nonnull;

public class AbstractType<T> {
    @Nonnull private final T value;

    protected AbstractType(@Nonnull final T value) {
        this.value = value;
    }

    @Nonnull
    public T value() {
        return value;
    }

    @Nonnull
    @Override
    public String toString() {
        return String.valueOf(value);
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }

        final AbstractType that = (AbstractType) o;
        return Objects.equals(this.value, that.value);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(value);
    }

}

Make the abstract types non-nullable


/*
 * Copyright (c) 2015-2017, Index Data
 * All rights reserved.
 * See the file LICENSE for details.
 */
package org.folio.okapi.bean;

/**
 * List of Permissions (and permission sets) belonging to a module. Used as a
 * parameter in the system request to initialize the permission module when a a
 * module is being enabled for a tenant.
 *
 * @author heikki
 */
public class PermissionList {
  String moduleId; // The module that own these permissions.
  Permission[] perms;

  public PermissionList() {
  }

  public PermissionList(String moduleId, Permission[] perms) {
    this.moduleId = moduleId;
    this.perms = perms.clone();
  }

  public PermissionList(PermissionList other) {
    this.moduleId = other.moduleId;
    this.perms = other.perms.clone();
  }

  public String getModuleId() {
    return moduleId;
  }

  public void setModuleId(String moduleId) {
    this.moduleId = moduleId;
  }

  public Permission[] getPerms() {
    return perms;
  }

  public void setPerms(Permission[] perms) {
    this.perms = perms;
  }

}

package org.folio.okapi.bean;

/**
 * List of Permissions (and permission sets) belonging to a module. Used as a
 * parameter in the system request to initialize the permission module when a
 * module is being enabled for a tenant.
 *
 * @author heikki
 */
public class PermissionList {
  String moduleId; // The module that owns these permissions.
  Permission[] perms;

  public PermissionList() {
  }

  public PermissionList(String moduleId, Permission[] perms) {
    this.moduleId = moduleId;
    this.perms = perms.clone();
  }

  public PermissionList(PermissionList other) {
    this.moduleId = other.moduleId;
    this.perms = other.perms.clone();
  }

  public String getModuleId() {
    return moduleId;
  }

  public void setModuleId(String moduleId) {
    this.moduleId = moduleId;
  }

  public Permission[] getPerms() {
    return perms;
  }

  public void setPerms(Permission[] perms) {
    this.perms = perms;
  }

}

Remove superfluous license headers (OKAPI-109)


package org.dandelion.config;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.*;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * Created on 2016-01-18.
 *
 * @author dolphineor
 */
@Configuration
@EnableAspectJAutoProxy(proxyTargetClass = true)
@ImportResource(locations = {"classpath:spring-mybatis.xml"})
@ComponentScan(basePackages = {"com.github.dolphineor.service"},
        excludeFilters = {
                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = org.springframework.stereotype.Repository.class),
                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = org.springframework.stereotype.Controller.class),
                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = org.springframework.web.bind.annotation.RestController.class)}
)
public class RootConfig {

    private static Resource[] propertyLocations = {new ClassPathResource("jdbc-mysql.properties")};

    // 加载*.properties文件
    @Bean
    public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
        PropertyPlaceholderConfigurer propertyPlaceholderConfigurer =
                new PropertyPlaceholderConfigurer();
        propertyPlaceholderConfigurer.setLocations(propertyLocations);

        return propertyPlaceholderConfigurer;
    }
}

package org.dandelion.config;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.*;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * Created on 2016-01-18.
 *
 * @author dolphineor
 */
@Configuration
@EnableAspectJAutoProxy(proxyTargetClass = true)
@ImportResource(locations = {"classpath:spring-mybatis.xml"})
@ComponentScan(basePackages = {"org.dandelion.service"},
        excludeFilters = {
                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = org.springframework.stereotype.Repository.class),
                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = org.springframework.stereotype.Controller.class),
                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = org.springframework.web.bind.annotation.RestController.class)}
)
public class RootConfig {

    private static Resource[] propertyLocations = {new ClassPathResource("jdbc-mysql.properties")};

    // 加载*.properties文件
    @Bean
    public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
        PropertyPlaceholderConfigurer propertyPlaceholderConfigurer =
                new PropertyPlaceholderConfigurer();
        propertyPlaceholderConfigurer.setLocations(propertyLocations);

        return propertyPlaceholderConfigurer;
    }
}

Change Spring basePackages scan directory


package org.gluu.jsf2.service;

import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import javax.faces.application.ViewHandler;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

/**
 * @author Yuriy Movchan
 * @version 03/17/2017
 */
public class FacesResources {

	@Produces
	@Dependent
	public FacesContext getFacesContext() {
		return FacesContext.getCurrentInstance();
	}

	@Produces
	@Dependent
	public ExternalContext getExternalContext() {
		FacesContext facesContext = getFacesContext();
		if (facesContext != null) {
			return facesContext.getExternalContext();
		}

		return null;
	}

	@Produces
	@Dependent
	public ViewHandler getViewHandler() {
		FacesContext facesContext = getFacesContext();
		if (facesContext != null) {
			return facesContext.getApplication().getViewHandler();
		}

		return null;
	}

}

package org.gluu.jsf2.service;

import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.faces.application.ViewHandler;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;

/**
 * @author Yuriy Movchan
 * @version 03/17/2017
 */
public class FacesResources {

	@Produces
	@RequestScoped
	public FacesContext getFacesContext() {
		return FacesContext.getCurrentInstance();
	}

	@Produces
	@RequestScoped
	public ExternalContext getExternalContext() {
		FacesContext facesContext = getFacesContext();
		if (facesContext != null) {
			return facesContext.getExternalContext();
		}

		return null;
	}

	@Produces
	@Dependent
	public ViewHandler getViewHandler() {
		FacesContext facesContext = getFacesContext();
		if (facesContext != null) {
			return facesContext.getApplication().getViewHandler();
		}

		return null;
	}

}

Fix External and Faces contexts scopes


package com.antew.redditinpictures.library;

import com.antew.redditinpictures.library.utils.MainThreadBus;
import com.squareup.otto.Bus;
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;

/**
 * Dagger module for setting up provides statements.
 * Register all of your entry points below.
 */
@Module
    (
        complete = false,

        injects = {
            RedditInPicturesApplication.class,
        }, library = true

    )
public class ApplicationModule {

    @Singleton
    @Provides Bus provideOttoBus() {
        return new MainThreadBus(new Bus());
    }

}

package com.antew.redditinpictures.library;

import com.antew.redditinpictures.library.ui.ImageDetailActivity;
import com.antew.redditinpictures.library.ui.ImageGridActivity;
import com.antew.redditinpictures.library.ui.ImageGridFragment;
import com.antew.redditinpictures.library.ui.ImageListFragment;
import com.antew.redditinpictures.library.utils.MainThreadBus;
import com.squareup.otto.Bus;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Dagger module for setting up provides statements.
 * Register all of your entry points below.
 */
@Module
    (
        complete = false,

        injects = {
            RedditInPicturesApplication.class,
            ImageGridFragment.class,
            ImageListFragment.class,
            ImageGridActivity.class,
            ImageDetailActivity.class
        }, library = true
    )
public class ApplicationModule {

    @Singleton
    @Provides Bus provideOttoBus() {
        return new MainThreadBus(new Bus());
    }

}

Add additional classes for injection.


// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.dnd;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;

public abstract class DnDManager {
  public static DnDManager getInstance() {
    return ApplicationManager.getApplication().getService(DnDManager.class);
  }

  public abstract void registerSource(@NotNull DnDSource source, @NotNull JComponent component);

  public abstract void registerSource(@NotNull AdvancedDnDSource source);

  public abstract void unregisterSource(@NotNull DnDSource source, @NotNull JComponent component);

  public abstract void unregisterSource(@NotNull AdvancedDnDSource source);

  public abstract void registerTarget(DnDTarget target, JComponent component);

  public abstract void unregisterTarget(DnDTarget target, JComponent component);

  @Nullable
  public abstract Component getLastDropHandler();

  /**
   * This key is intended to switch on a smooth scrolling during drag-n-drop operations.
   * Note, that the target component must not use default auto-scrolling.
   *
   * @see java.awt.dnd.Autoscroll
   * @see JComponent#setAutoscrolls
   * @see JComponent#putClientProperty
   */
  public static final Key<Boolean> AUTO_SCROLL = Key.create("AUTO_SCROLL");
}

// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.dnd;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;

public abstract class DnDManager {
  public static DnDManager getInstance() {
    return ApplicationManager.getApplication().getService(DnDManager.class);
  }

  public abstract void registerSource(@NotNull DnDSource source, @NotNull JComponent component);

  public abstract void registerSource(@NotNull AdvancedDnDSource source);

  public abstract void unregisterSource(@NotNull DnDSource source, @NotNull JComponent component);

  public abstract void unregisterSource(@NotNull AdvancedDnDSource source);

  public abstract void registerTarget(DnDTarget target, JComponent component);

  public abstract void unregisterTarget(DnDTarget target, JComponent component);

  @Nullable
  public abstract Component getLastDropHandler();

  /**
   * This key is intended to switch on a smooth scrolling during drag-n-drop operations.
   * Note, that the target component must not use default auto-scrolling.
   *
   * @see java.awt.dnd.Autoscroll
   * @see JComponent#setAutoscrolls
   * @see JComponent#putClientProperty
   */
  @ApiStatus.Experimental
  public static final Key<Boolean> AUTO_SCROLL = Key.create("AUTO_SCROLL");
}

Mark API as experimental, because of javax.swing.TransferHandler.DropHandler.autoscroll


/*
 * Copyright (C) 2013 Jerzy Chalupski
 *
 * 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.getbase.autoindexer;

import com.google.common.base.Objects;

public class SqliteIndex {
  public final String mTable;
  public final String[] mColumns;

  public SqliteIndex(String table, String... columns) {
    mTable = table;
    mColumns = columns;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    SqliteIndex that = (SqliteIndex) o;

    return Objects.equal(mTable, that.mTable) &&
        Objects.equal(mColumns, that.mColumns);
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(mTable, mColumns);
  }
}

/*
 * Copyright (C) 2013 Jerzy Chalupski
 *
 * 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.getbase.autoindexer;

import com.google.common.base.Objects;

import java.util.Arrays;

public class SqliteIndex {
  public final String mTable;
  public final String[] mColumns;

  public SqliteIndex(String table, String... columns) {
    mTable = table;
    mColumns = columns;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    SqliteIndex that = (SqliteIndex) o;

    return Objects.equal(mTable, that.mTable) &&
        Objects.equal(mColumns, that.mColumns);
  }

  @Override
  public String toString() {
    return "SQLiteIndex on " + mTable + Arrays.toString(mColumns);
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(mTable, mColumns);
  }
}

Add custom toString() to SQLiteIndex


package com.alibaba.json.bvt.issue_1100;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.alibaba.fastjson.TypeReference;
import junit.framework.TestCase;

import java.util.Map;

/**
 * Created by wenshao on 05/05/2017.
 */
public class Issue1177_2 extends TestCase {
    public void test_for_issue() throws Exception {
        String text = "{\"a\":{\"x\":\"y\"},\"b\":{\"x\":\"y\"}}";
        Map<String, Model> jsonObject = JSONObject.parseObject(text, new TypeReference<Map<String, Model>>(){});
        System.out.println(JSON.toJSONString(jsonObject));
        String jsonpath = "$..x";
        String value="y2";
        JSONPath.set(jsonObject, jsonpath, value);
        assertEquals("{\"a\":{\"x\":\"y2\"},\"b\":{\"x\":\"y2\"}}", JSON.toJSONString(jsonObject));

    }

    public static class Model {
        public String x;
    }
}

package com.alibaba.json.bvt.issue_1100;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.alibaba.fastjson.TypeReference;
import junit.framework.TestCase;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by wenshao on 05/05/2017.
 */
public class Issue1177_2 extends TestCase {
    public void test_for_issue() throws Exception {
        String text = "{\"a\":{\"x\":\"y\"},\"b\":{\"x\":\"y\"}}";
        Map<String, Model> jsonObject = JSONObject.parseObject(text, new TypeReference<LinkedHashMap<String, Model>>(){});
        System.out.println(JSON.toJSONString(jsonObject));
        String jsonpath = "$..x";
        String value="y2";
        JSONPath.set(jsonObject, jsonpath, value);
        assertEquals("{\"a\":{\"x\":\"y2\"},\"b\":{\"x\":\"y2\"}}", JSON.toJSONString(jsonObject));

    }

    public static class Model {
        public String x;
    }
}

Use LinkedHashMap for deterministic order


package mesosphere.marathon.client.model.v2;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import mesosphere.marathon.client.utils.ModelUtils;

public class Docker {
	private String image;
	private String network;
	private Collection<Port> portMappings;
	private List<Parameter> parameters;
	private boolean privileged;

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getNetwork() {
		return network;
	}

	public void setNetwork(String network) {
		this.network = network;
	}

	public Collection<Port> getPortMappings() {
		return portMappings;
	}

	public void setPortMappings(Collection<Port> portMappings) {
		this.portMappings = portMappings;
	}

	public boolean isPrivileged() {
		return privileged;
	}

	public void setPrivileged(boolean privileged) {
		this.privileged = privileged;
	}

	public List<Parameter> getParameters() {
		return parameters;
	}

	public void setParameters(List<Parameter> parameters) {
		this.parameters = parameters;
	}

	@Override
	public String toString() {
		return ModelUtils.toString(this);
	}
}

package mesosphere.marathon.client.model.v2;

import mesosphere.marathon.client.utils.ModelUtils;

import java.util.Collection;
import java.util.List;

public class Docker {
	private String image;
	private String network;
	private boolean forcePullImage;
	private Collection<Port> portMappings;
	private List<Parameter> parameters;
	private boolean privileged;

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getNetwork() {
		return network;
	}

	public void setNetwork(String network) {
		this.network = network;
	}

	public Collection<Port> getPortMappings() {
		return portMappings;
	}

	public void setPortMappings(Collection<Port> portMappings) {
		this.portMappings = portMappings;
	}

	public boolean isPrivileged() {
		return privileged;
	}

	public void setPrivileged(boolean privileged) {
		this.privileged = privileged;
	}

	public List<Parameter> getParameters() {
		return parameters;
	}

	public void setParameters(List<Parameter> parameters) {
		this.parameters = parameters;
	}

	public boolean isForcePullImage() {
		return forcePullImage;
	}

	public void setForcePullImage(boolean forcePullImage) {
		this.forcePullImage = forcePullImage;
	}
	@Override
	public String toString() {
		return ModelUtils.toString(this);
	}

}

Add option to force docker pull


package com.bazaarvoice.dropwizard.assets;

import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
import java.util.Map;

public class AssetsConfiguration {

    @NotNull
    @JsonProperty
    private String cacheSpec = ConfiguredAssetsBundle.DEFAULT_CACHE_SPEC.toParsableString();

    @NotNull
    @JsonProperty
    private Map<String, String> overrides = Maps.newHashMap();

    @JsonProperty
    private Map<String, String> mimeTypes = Maps.newHashMap();

    /** The caching specification for how to memoize assets. */
    public String getCacheSpec() {
        return cacheSpec;
    }

    public Iterable<Map.Entry<String, String>> getOverrides() {
        return Iterables.unmodifiableIterable(overrides.entrySet());
    }

    public Iterable<Map.Entry<String, String>> getMimeTypes() {
        return Iterables.unmodifiableIterable(mimeTypes.entrySet());
    }
}

package com.bazaarvoice.dropwizard.assets;

import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
import java.util.Map;

public class AssetsConfiguration {
    @NotNull
    @JsonProperty
    private String cacheSpec = ConfiguredAssetsBundle.DEFAULT_CACHE_SPEC.toParsableString();

    @NotNull
    @JsonProperty
    private Map<String, String> overrides = Maps.newHashMap();

    @NotNull
    @JsonProperty
    private Map<String, String> mimeTypes = Maps.newHashMap();

    /** The caching specification for how to memoize assets. */
    public String getCacheSpec() {
        return cacheSpec;
    }

    public Iterable<Map.Entry<String, String>> getOverrides() {
        return Iterables.unmodifiableIterable(overrides.entrySet());
    }

    public Iterable<Map.Entry<String, String>> getMimeTypes() {
        return Iterables.unmodifiableIterable(mimeTypes.entrySet());
    }
}

Revert "remove not null constraint"


package tr.xip.horriblesubsschedule;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return super.onCreateOptionsMenu(menu);
    }
}

package tr.xip.horriblesubsschedule;

import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT)
            getActionBar().setIcon(android.R.color.transparent);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return super.onCreateOptionsMenu(menu);
    }
}

Hide action bar icon on pre-L devices


package lib.morkim.mfw.ui;

import lib.morkim.mfw.usecase.UseCase;
import lib.morkim.mfw.usecase.UseCaseResult;
import lib.morkim.mfw.usecase.UseCaseProgress;

public class EmptyPresenter extends Presenter {

	public EmptyPresenter(Viewable viewable) {
		super(viewable);
	}

	@Override
	public void onUseCaseStart(UseCase useCase) {}

	@Override
	public void onUseCaseUpdate(UseCaseProgress response) {}

	@Override
	public void onUseCaseComplete(UseCaseResult response) {}

	@Override
	public void onUseCaseCancel() {}

}

package lib.morkim.mfw.ui;

public class EmptyPresenter extends Presenter {

	public EmptyPresenter(Viewable viewable) {
		super(viewable);
	}

}

Remove view model in presenter


package org.ligoj.app.model;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import org.ligoj.bootstrap.core.model.AbstractAudited;
import lombok.Getter;
import lombok.Setter;

/**
 * A message to target audience.
 */
@Getter
@Setter
@Entity
@Table(name = "LIGOJ_MESSAGE")
public class Message extends AbstractAudited<Integer> {

	/**
	 * SID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Type of target (group, user, ...). When null the target is everybody.
	 *
	 * @see MessageTargetType
	 */
	@Enumerated(EnumType.STRING)
	@NotNull
	private MessageTargetType targetType;

	/**
	 * Optional related target : user, group, node, ...
	 */
	@NotNull
	private String target;

	/**
	 * Value of the message.
	 */
	@Length(max = 500)
	@NotNull
	@NotBlank
	private String value;
}

package org.ligoj.app.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import org.ligoj.bootstrap.core.model.AbstractAudited;
import lombok.Getter;
import lombok.Setter;

/**
 * A message to target audience.
 */
@Getter
@Setter
@Entity
@Table(name = "LIGOJ_MESSAGE")
public class Message extends AbstractAudited<Integer> {

	/**
	 * SID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Type of target (group, user, ...). When null the target is everybody.
	 *
	 * @see MessageTargetType
	 */
	@Enumerated(EnumType.STRING)
	@NotNull
	@Column(length = 10)
	private MessageTargetType targetType;

	/**
	 * Optional related target : user, group, node, ...
	 */
	@NotNull
	private String target;

	/**
	 * Value of the message.
	 */
	@Length(max = 500)
	@NotNull
	@NotBlank
	private String value;
}

Reduce the column size for well known content


package camelinaction;

import org.apache.camel.jsonpath.JsonPath;
import org.apache.camel.language.Bean;

/**
 * A bean that acts as a JSon order service to handle incoming JSon orders
 */
public class JSonOrderService {

    public String handleIncomingOrder(@JsonPath("$.order.customerId") int customerId,
                                      @JsonPath("$.order.item") String item,
                                      @Bean(ref = "guid", method = "generate") int orderId) {

        // convert the order to a CSV and inject the generated order id
        return String.format("%s,%s,'%s'", orderId, customerId, item);
    }

}

package camelinaction;

import org.apache.camel.jsonpath.JsonPath;
import org.apache.camel.language.Bean;

/**
 * A bean that acts as a JSon order service to handle incoming JSon orders
 */
public class JSonOrderService {

    public String handleIncomingOrder(@JsonPath("$.order.customerId") int customerId,
                                      @JsonPath("$.order.item") String item,
                                      @Bean(ref = "guid", method = "generate") int orderId) {

        // convert the order to a CSV and inject the generated order id
        return String.format("%d,%s,'%s'", orderId, customerId, item);
    }

}

Use %d to format int value


package remonsinnema.blog.fizzbuzz;

import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;

public class FizzBuzz {

  private final Collection<MultipleReplacer> replacers = Arrays.asList(
      new MultipleReplacer(3, "Fizz"), new MultipleReplacer(5, "Buzz"));

  public String get(int n) {
    StringBuilder result = new StringBuilder();
    for (MultipleReplacer replacer : replacers) {
      Optional<String> replacement = replacer.textFor(n);
      if (replacement.isPresent()) {
        result.append(replacement.get());
      }
    }
    if (result.length() > 0) {
      return result.toString();
    }
    return Integer.toString(n);
  }

}

package remonsinnema.blog.fizzbuzz;

import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;

public class FizzBuzz {

  private final Collection<MultipleReplacer> replacers = Arrays.asList(
      new MultipleReplacer(3, "Fizz"), new MultipleReplacer(5, "Buzz"));

  public String get(int n) {
    return replacers.stream()
        .map(replacer -> replacer.textFor(n))
        .filter(Optional::isPresent)
        .map(optional -> optional.get())
        .reduce((a, b) -> a + b)
        .orElse(Integer.toString(n));
  }

}

Use streams instead of loops and conditionals


package sizebay.catalog.client.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class DevolutionSummary {
	private Long id;
	private long tenantId;
	private int insertedReturns;
	private int invalidReturns;
	private int totalReturns;
}

package sizebay.catalog.client.model;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class DevolutionSummary {
	private Long id;
	private long tenantId;
	private int insertedReturns;
	private int invalidReturns;
	private int totalReturns;

	public DevolutionSummary(long tenantId) {
		this.setTenantId(tenantId);
	}
}

Create constructor in devolutionSummary class