    public static File unzip( Class<?> testClass, String resource, File targetDirectory ) throws IOException
    {
        InputStream source = testClass.getResourceAsStream( resource );
        if ( source == null )
        {
            throw new FileNotFoundException( "Could not find resource '" + resource + "' to unzip" );
        }

        try
        {
            ZipInputStream zipStream = new ZipInputStream( source );
            ZipEntry entry = null;
            byte[] scratch = new byte[8096];
            while ( (entry = zipStream.getNextEntry()) != null )
            {
                if ( entry.isDirectory() )
                {
                    new File( targetDirectory, entry.getName() ).mkdirs();
                }
                else
                {
                    try ( OutputStream file = new BufferedOutputStream(
                            new FileOutputStream( new File( targetDirectory, entry.getName() ) ) ) )
                    {
                        long toCopy = entry.getSize();
                        while ( toCopy > 0 )
                        {
                            int read = zipStream.read( scratch );
                            file.write( scratch, 0, read );
                            toCopy -= read;
                        }
                    }
                }
                zipStream.closeEntry();
            }
        }
        finally
        {
            source.close();
        }
        return targetDirectory;
    }

    public static File unzip( Class<?> testClass, String resource, File targetDirectory ) throws IOException
    {
        InputStream source = testClass.getResourceAsStream( resource );
        if ( source == null )
        {
            throw new FileNotFoundException( "Could not find resource '" + resource + "' to unzip" );
        }

        try
        {
            ZipInputStream zipStream = new ZipInputStream( source );
            ZipEntry entry = null;
            byte[] scratch = new byte[8096];
            while ( (entry = zipStream.getNextEntry()) != null )
            {
                if ( entry.isDirectory() )
                {
                    new File( targetDirectory, entry.getName() ).mkdirs();
                }
                else
                {
                    OutputStream file = new BufferedOutputStream(
                            new FileOutputStream( new File( targetDirectory, entry.getName() ) ) );
                    try
                    {
                        long toCopy = entry.getSize();
                        while ( toCopy > 0 )
                        {
                            int read = zipStream.read( scratch );
                            file.write( scratch, 0, read );
                            toCopy -= read;
                        }
                    }
                    finally
                    {
                        file.close();
                    }
                }
                zipStream.closeEntry();
            }
        }
        finally
        {
            source.close();
        }
        return targetDirectory;
    }

Try With Resources try(OutputStream file=new BufferedOutputStream(new FileOutputStream(new File(targetDirectory,entry.getName())))) in method public unzip(testClass Class<?>, resource String, targetDirectory File) : File from class org.neo4j.test.Unzip


        ParameterBuilder( Class<?> suiteClass ) throws InitializationError
        {
            this.suiteClass = suiteClass;
            boolean ok = false;
            for ( Constructor<?> suiteConstructor : suiteClass.getConstructors() )
            {
                if ( suiteConstructor.getParameterTypes().length == 0 )
                {
                    if ( Modifier.isPublic( suiteConstructor.getModifiers() ) )
                    {
                        ok = true;
                    }
                    break;
                }
            }
            List<Throwable> errors = new ArrayList<>();
            if ( !ok )
            {
                errors.add( new IllegalArgumentException( "Suite class (" + suiteClass.getName() +
                        ") does not have a public zero-arg constructor." ) );
            }
            if ( Modifier.isAbstract( suiteClass.getModifiers() ) )
            {
                errors.add(
                        new IllegalArgumentException( "Suite class (" + suiteClass.getName() + ") is abstract." ) );
            }
            buildParameterizations( parameterizations, suiteClass, errors );
            if ( !errors.isEmpty() )
            {
                throw new InitializationError( errors );
            }
        }

        ParameterBuilder( Class<?> suiteClass ) throws InitializationError
        {
            this.suiteClass = suiteClass;
            boolean ok = false;
            for ( Constructor<?> suiteConstructor : suiteClass.getConstructors() )
            {
                if ( suiteConstructor.getParameterTypes().length == 0 )
                {
                    if ( Modifier.isPublic( suiteConstructor.getModifiers() ) )
                    {
                        ok = true;
                    }
                    break;
                }
            }
            List<Throwable> errors = new ArrayList<Throwable>();
            if ( !ok )
            {
                errors.add( new IllegalArgumentException( "Suite class (" + suiteClass.getName() +
                        ") does not have a public zero-arg constructor." ) );
            }
            if ( Modifier.isAbstract( suiteClass.getModifiers() ) )
            {
                errors.add(
                        new IllegalArgumentException( "Suite class (" + suiteClass.getName() + ") is abstract." ) );
            }
            buildParameterizations( parameterizations, suiteClass, errors );
            if ( !errors.isEmpty() )
            {
                throw new InitializationError( errors );
            }
        }

Replace Generic With Diamond ArrayList<Throwable> with ArrayList<> in method package ParameterBuilder(suiteClass Class<?>) from class org.neo4j.test.runner.ParameterizedSuiteRunner.ParameterBuilder


        Class<?>[] suiteClasses()
        {
            ArrayList<Class<?>> classes = new ArrayList<>( parameterizations.keySet() );
            for ( Method method : suiteClass.getMethods() )
            {
                if ( method.getAnnotation( Test.class ) != null )
                {
                    classes.add( suiteClass );
                }
            }
            return classes.toArray( new Class[classes.size()] );
        }

        Class<?>[] suiteClasses()
        {
            ArrayList<Class<?>> classes = new ArrayList<Class<?>>( parameterizations.keySet() );
            for ( Method method : suiteClass.getMethods() )
            {
                if ( method.getAnnotation( Test.class ) != null )
                {
                    classes.add( suiteClass );
                }
            }
            return classes.toArray( new Class[classes.size()] );
        }

Replace Generic With Diamond ArrayList<Class<?>> with ArrayList<> in method package suiteClasses() : Class<?>[] from class org.neo4j.test.runner.ParameterizedSuiteRunner.ParameterBuilder


        int stop( TimeUnit unit, long timeout )
        {
            final CountDownLatch latch = new CountDownLatch( unit == null ? 0 : 1 );
            Thread stopper = new Thread( () -> {
                latch.countDown();
                try
                {
                    dispatcher.stop();
                }
                catch ( RemoteException e )
                {
                    process.destroy();
                }
            } );
            stopper.start();
            try
            {
                latch.await();
                timeout = System.currentTimeMillis() + ( unit == null ? 0 : unit.toMillis( timeout ) );
                while ( stopper.isAlive() && System.currentTimeMillis() < timeout )
                {
                    Thread.sleep( 1 );
                }
            }
            catch ( InterruptedException e )
            {
                // handled by exit
            }
            if ( stopper.isAlive() )
            {
                stopper.interrupt();
            }
            dead( this );
            return await( process );
        }

        int stop( TimeUnit unit, long timeout )
        {
            final CountDownLatch latch = new CountDownLatch( unit == null ? 0 : 1 );
            Thread stopper = new Thread()
            {
                @Override
                public void run()
                {
                    latch.countDown();
                    try
                    {
                        dispatcher.stop();
                    }
                    catch ( RemoteException e )
                    {
                        process.destroy();
                    }
                }
            };
            stopper.start();
            try
            {
                latch.await();
                timeout = System.currentTimeMillis() + ( unit == null ? 0 : unit.toMillis( timeout ) );
                while ( stopper.isAlive() && System.currentTimeMillis() < timeout )
                {
                    Thread.sleep( 1 );
                }
            }
            catch ( InterruptedException e )
            {
                // handled by exit
            }
            if ( stopper.isAlive() )
            {
                stopper.interrupt();
            }
            dead( this );
            return await( process );
        }

Replace Anonymous With Lambda org.neo4j.test.subprocess.SubProcess.Handler.stop.stopper.new Thread with () -> {latch.countDown(); in method package stop(unit TimeUnit, timeout long) : int from class org.neo4j.test.subprocess.SubProcess.Handler


    public RandomEntityDataGenerator( long nodeCount, long count, int batchSize, long seed, long startId, Header header,
           Distribution<String> labels, Distribution<String> relationshipTypes, float factorBadNodeData, float factorBadRelationshipData )
    {
        super( count, batchSize, new RandomsStates( seed ), ( randoms, visitor, id ) -> {
            for ( Entry entry : header.entries() )
            {
                switch ( entry.type() )
                {
                case ID:
                    if ( factorBadNodeData > 0 && id > 0 )
                    {
                        if ( randoms.nextFloat() <= factorBadNodeData )
                        {
                            // id between 0 - id
                            id = randoms.nextLong( id );
                        }
                    }
                    visitor.id( idValue( entry, id ), entry.group() );
                    if ( entry.name() != null )
                    {
                        visitor.property( entry.name(), id );
                    }
                    break;
                case PROPERTY:
                    visitor.property( entry.name(), randomProperty( entry, randoms ) );
                    break;
                case LABEL:
                    visitor.labels( randomLabels( randoms.random(), labels ) );
                    break;
                case START_ID:
                case END_ID:
                    long nodeId = randoms.nextLong( nodeCount );
                    if ( factorBadRelationshipData > 0 && nodeId > 0 )
                    {
                        if ( randoms.nextFloat() <= factorBadRelationshipData )
                        {
                            if ( randoms.nextBoolean() )
                            {
                                // simply missing field
                                break;
                            }
                            // referencing some very likely non-existent node id
                            nodeId = randoms.nextLong();
                        }
                    }
                    if ( entry.type() == Type.START_ID )
                    {
                        visitor.startId( idValue( entry, nodeId ), entry.group() );
                    }
                    else
                    {
                        visitor.endId( idValue( entry, nodeId ), entry.group() );
                    }
                    break;
                case TYPE:
                    visitor.type( randomRelationshipType( randoms.random(), relationshipTypes ) );
                    break;
                default:
                    throw new IllegalArgumentException( entry.toString() );
                }
            }
        }, startId );
    }

    public RandomEntityDataGenerator( long nodeCount, long count, int batchSize, long seed, long startId, Header header,
           Distribution<String> labels, Distribution<String> relationshipTypes, float factorBadNodeData, float factorBadRelationshipData )
    {
        super( count, batchSize, new RandomsStates( seed ), new Generator<Randoms>()
        {
            @Override
            public void accept( Randoms randoms, InputEntityVisitor visitor, long id ) throws IOException
            {
                for ( Entry entry : header.entries() )
                {
                    switch ( entry.type() )
                    {
                    case ID:
                        if ( factorBadNodeData > 0 && id > 0 )
                        {
                            if ( randoms.nextFloat() <= factorBadNodeData )
                            {
                                // id between 0 - id
                                id = randoms.nextLong( id );
                            }
                        }
                        visitor.id( idValue( entry, id ), entry.group() );
                        if ( entry.name() != null )
                        {
                            visitor.property( entry.name(), id );
                        }
                        break;
                    case PROPERTY:
                        visitor.property( entry.name(), randomProperty( entry, randoms ) );
                        break;
                    case LABEL:
                        visitor.labels( randomLabels( randoms.random(), labels ) );
                        break;
                    case START_ID:
                    case END_ID:
                        long nodeId = randoms.nextLong( nodeCount );
                        if ( factorBadRelationshipData > 0 && nodeId > 0 )
                        {
                            if ( randoms.nextFloat() <= factorBadRelationshipData )
                            {
                                if ( randoms.nextBoolean() )
                                {
                                    // simply missing field
                                    break;
                                }
                                // referencing some very likely non-existent node id
                                nodeId = randoms.nextLong();
                            }
                        }
                        if ( entry.type() == Type.START_ID )
                        {
                            visitor.startId( idValue( entry, nodeId ), entry.group() );
                        }
                        else
                        {
                            visitor.endId( idValue( entry, nodeId ), entry.group() );
                        }
                        break;
                    case TYPE:
                        visitor.type( randomRelationshipType( randoms.random(), relationshipTypes ) );
                        break;
                    default:
                        throw new IllegalArgumentException( entry.toString() );
                    }
                }
            }
        }, startId );
    }

Replace Anonymous With Lambda org.neo4j.unsafe.impl.batchimport.input.RandomEntityDataGenerator.RandomEntityDataGenerator.new Generator<Randoms> with (randoms, visitor, id) -> {for(Entry entry: header.entries()){switch(entry.type())case ID:if(factorBadNodeData > 0 && id > 0){if(randoms.nextFloat() <= factorBadNodeData){id=randoms.nextLong(id); in method public RandomEntityDataGenerator(nodeCount long, count long, batchSize int, seed long, startId long, header Header, labels Distribution<String>, relationshipTypes Distribution<String>, factorBadNodeData float, factorBadRelationshipData float) from class org.neo4j.unsafe.impl.batchimport.input.RandomEntityDataGenerator


    @Test
    public void shouldProcessAllMultiThreadedAndWithChangingProcessorCount() throws Exception
    {
        // GIVEN
        StageControl control = mock( StageControl.class );
        int availableProcessors = Runtime.getRuntime().availableProcessors();
        BatchProcessor step = new BatchProcessor( control, availableProcessors );
        TrackingStep downstream = new TrackingStep();
        step.setDownstream( downstream );

        // WHEN
        step.start( 0 );
        AtomicLong nextTicket = new AtomicLong();
        Thread[] submitters = new Thread[3];
        AtomicBoolean end = new AtomicBoolean();
        for ( int i = 0; i < submitters.length; i++ )
        {
            submitters[i] = new Thread( () -> {
                ThreadLocalRandom random = ThreadLocalRandom.current();
                while ( !end.get() )
                {
                    // synchronized block simulating that batches are received in order,
                    // which is enforced in real environment of a stage.
                    synchronized ( nextTicket )
                    {
                        // The processor count is changed here in this block simply because otherwise
                        // it's very hard to know how many processors we expect to see have processed
                        // a particular batch.
                        if ( random.nextFloat() < 0.1 )
                        {
                            step.processors( random.nextInt( -2, 4 ) );
                        }

                        long ticket = nextTicket.incrementAndGet();
                        Batch batch = new Batch( step.processors( 0 ) );
                        step.receive( ticket, batch );
                    }
                }
            } );
            submitters[i].start();
        }

        while ( downstream.received.get() < 200 )
        {
            Thread.sleep( 10 );
        }
        end.set( true );
        for ( Thread submitter : submitters )
        {
            submitter.join();
        }
        step.endOfUpstream();
        step.close();
    }

    @Test
    public void shouldProcessAllMultiThreadedAndWithChangingProcessorCount() throws Exception
    {
        // GIVEN
        StageControl control = mock( StageControl.class );
        int availableProcessors = Runtime.getRuntime().availableProcessors();
        BatchProcessor step = new BatchProcessor( control, availableProcessors );
        TrackingStep downstream = new TrackingStep();
        step.setDownstream( downstream );

        // WHEN
        step.start( 0 );
        AtomicLong nextTicket = new AtomicLong();
        Thread[] submitters = new Thread[3];
        AtomicBoolean end = new AtomicBoolean();
        for ( int i = 0; i < submitters.length; i++ )
        {
            submitters[i] = new Thread()
            {
                @Override
                public void run()
                {
                    ThreadLocalRandom random = ThreadLocalRandom.current();
                    while ( !end.get() )
                    {
                        // synchronized block simulating that batches are received in order,
                        // which is enforced in real environment of a stage.
                        synchronized ( nextTicket )
                        {
                            // The processor count is changed here in this block simply because otherwise
                            // it's very hard to know how many processors we expect to see have processed
                            // a particular batch.
                            if ( random.nextFloat() < 0.1 )
                            {
                                step.processors( random.nextInt( -2, 4 ) );
                            }

                            long ticket = nextTicket.incrementAndGet();
                            Batch batch = new Batch( step.processors( 0 ) );
                            step.receive( ticket, batch );
                        }
                    }
                }
            };
            submitters[i].start();
        }

        while ( downstream.received.get() < 200 )
        {
            Thread.sleep( 10 );
        }
        end.set( true );
        for ( Thread submitter : submitters )
        {
            submitter.join();
        }
        step.endOfUpstream();
        step.close();
    }

Replace Anonymous With Lambda org.neo4j.unsafe.impl.batchimport.staging.ForkedProcessorStepTest.shouldProcessAllMultiThreadedAndWithChangingProcessorCount.new Thread with () -> {ThreadLocalRandom random=ThreadLocalRandom.current(); in method public shouldProcessAllMultiThreadedAndWithChangingProcessorCount() : void from class org.neo4j.unsafe.impl.batchimport.staging.ForkedProcessorStepTest


    public static <T> Collection<T> asCollection( Iterable<T> iterable )
    {
        List<T> list = new ArrayList<>();
        for ( T item : iterable )
        {
            list.add( item );
        }
        return list;
    }

    public static <T> Collection<T> asCollection( Iterable<T> iterable )
    {
        List<T> list = new ArrayList<T>();
        for ( T item : iterable )
        {
            list.add( item );
        }
        return list;
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method public asCollection(iterable Iterable<T>) : Collection<T> from class org.neo4j.index.Neo4jTestCase


    @Factory
    public static <T> Contains<T> contains( T... expectedItems )
    {
        return new Contains<>( expectedItems );
    }

    @Factory
    public static <T> Contains<T> contains( T... expectedItems )
    {
        return new Contains<T>( expectedItems );
    }

Replace Generic With Diamond Contains<T> with Contains<> in method public contains(expectedItems T...) : Contains<T> from class org.neo4j.index.impl.lucene.explicit.Contains


    public static void main( String[] args ) throws IOException
    {
        File path = new File( args[0] );
        final GraphDatabaseService db = new TestGraphDatabaseFactory()
                .newEmbeddedDatabaseBuilder( path )
                .newGraphDatabase();
        final Index<Node> index = getIndex( db );
        final String[] keys = new String[]{"apoc", "zion", "morpheus"};
        final String[] values = new String[]{"hej", "yo", "something", "just a value", "anything"};

        for ( int i = 0; i < 5; i++ )
        {
            new Thread( () -> {
                while ( true )
                {
                    try ( Transaction tx = db.beginTx() )
                    {
                        for ( int i1 = 0; i1 < 100; i1++ )
                        {
                            String key = keys[i1 % keys.length];
                            String value = values[i1 % values.length] + i1;

                            Node node = db.createNode();
                            node.setProperty( key, value );
                            index.add( node, key, value );
                        }
                        tx.success();
                    }
                }
            } ).start();
        }
        new File( path, "started" ).createNewFile();
    }

    public static void main( String[] args ) throws IOException
    {
        File path = new File( args[0] );
        final GraphDatabaseService db = new TestGraphDatabaseFactory()
                .newEmbeddedDatabaseBuilder( path )
                .newGraphDatabase();
        final Index<Node> index = getIndex( db );
        final String[] keys = new String[]{"apoc", "zion", "morpheus"};
        final String[] values = new String[]{"hej", "yo", "something", "just a value", "anything"};

        for ( int i = 0; i < 5; i++ )
        {
            new Thread()
            {
                @Override
                public void run()
                {
                    while ( true )
                    {
                        try ( Transaction tx = db.beginTx() )
                        {
                            for ( int i = 0; i < 100; i++ )
                            {
                                String key = keys[i % keys.length];
                                String value = values[i % values.length] + i;

                                Node node = db.createNode();
                                node.setProperty( key, value );
                                index.add( node, key, value );
                            }
                            tx.success();
                        }
                    }
                }
            }.start();
        }
        new File( path, "started" ).createNewFile();
    }

Replace Anonymous With Lambda org.neo4j.index.impl.lucene.explicit.Inserter.main.start.new Thread with () -> {while(true){try(Transaction tx=db.beginTx())for(int i1=0; i1 < 100; i1++){String key=keys[i1 % keys.length]; in method public main(args String[]) : void from class org.neo4j.index.impl.lucene.explicit.Inserter


    public MyStandardAnalyzer()
    {
        super( GLOBAL_REUSE_STRATEGY );
        CharArraySet stopWords = CharArraySet.copy( new HashSet<>( Arrays.asList( "just", "some", "words" ) ) );
        actual = new StandardAnalyzer( stopWords );
    }

    public MyStandardAnalyzer()
    {
        super( GLOBAL_REUSE_STRATEGY );
        CharArraySet stopWords = CharArraySet.copy( new HashSet<String>( Arrays.asList( "just", "some", "words" ) ) );
        actual = new StandardAnalyzer( stopWords );
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public MyStandardAnalyzer() from class org.neo4j.index.impl.lucene.explicit.MyStandardAnalyzer


    @Test
    @Graph( { "a TO b", "b TO c", "c TO a" } )
    public void canCreateGraphFromMultipleStrings() throws Exception
    {
        Map<String,Node> graph = data.get();
        Set<Node> unique = new HashSet<>();
        Node n = graph.get( "a" );
        while ( unique.add( n ) )
        {
            try ( Transaction ignored = graphdb.beginTx() )
            {
                n = n.getSingleRelationship( RelationshipType.withName( "TO" ), Direction.OUTGOING ).getEndNode();
            }
        }
        assertEquals( graph.size(), unique.size() );
    }

    @Test
    @Graph( { "a TO b", "b TO c", "c TO a" } )
    public void canCreateGraphFromMultipleStrings() throws Exception
    {
        Map<String,Node> graph = data.get();
        Set<Node> unique = new HashSet<Node>();
        Node n = graph.get( "a" );
        while ( unique.add( n ) )
        {
            try ( Transaction ignored = graphdb.beginTx() )
            {
                n = n.getSingleRelationship( RelationshipType.withName( "TO" ), Direction.OUTGOING ).getEndNode();
            }
        }
        assertEquals( graph.size(), unique.size() );
    }

Replace Generic With Diamond HashSet<Node> with HashSet<> in method public canCreateGraphFromMultipleStrings() : void from class org.neo4j.metatest.TestGraphDescription


    private InputIterable relationships( final long randomSeed, final long count, int batchSize,
            final InputIdGenerator idGenerator, final IdGroupDistribution groups )
    {
        return replayable( () -> new GeneratingInputIterator<>( count, batchSize, new RandomsStates( randomSeed ),
                ( randoms, visitor, id ) -> {
                    randomProperties( randoms, "Name " + id, visitor );
                    ExistingId startNodeExistingId = idGenerator.randomExisting( randoms.random() );
                    Group startNodeGroup = groups.groupOf( startNodeExistingId.nodeIndex );
                    ExistingId endNodeExistingId = idGenerator.randomExisting( randoms.random() );
                    Group endNodeGroup = groups.groupOf( endNodeExistingId.nodeIndex );

                    // miss some
                    Object startNode = idGenerator.miss( randoms.random(), startNodeExistingId.id, 0.001f );
                    Object endNode = idGenerator.miss( randoms.random(), endNodeExistingId.id, 0.001f );

                    visitor.startId( startNode, startNodeGroup );
                    visitor.endId( endNode, endNodeGroup );

                    String type = idGenerator.randomType( randoms.random() );
                    if ( randoms.random().nextFloat() < 0.00005 )
                    {
                        // Let there be a small chance of introducing a one-off relationship
                        // with a type that no, or at least very few, other relationships have.
                        type += "_odd";
                    }
                    visitor.type( type );
                }, 0 ) );
    }

    private InputIterable relationships( final long randomSeed, final long count, int batchSize,
            final InputIdGenerator idGenerator, final IdGroupDistribution groups )
    {
        return replayable( () -> new GeneratingInputIterator<>( count, batchSize, new RandomsStates( randomSeed ),
                new GeneratingInputIterator.Generator<Randoms>()
                {
                    @Override
                    public void accept( Randoms randoms, InputEntityVisitor visitor, long id ) throws IOException
                    {
                        randomProperties( randoms, "Name " + id, visitor );
                        ExistingId startNodeExistingId = idGenerator.randomExisting( randoms.random() );
                        Group startNodeGroup = groups.groupOf( startNodeExistingId.nodeIndex );
                        ExistingId endNodeExistingId = idGenerator.randomExisting( randoms.random() );
                        Group endNodeGroup = groups.groupOf( endNodeExistingId.nodeIndex );

                        // miss some
                        Object startNode = idGenerator.miss( randoms.random(), startNodeExistingId.id, 0.001f );
                        Object endNode = idGenerator.miss( randoms.random(), endNodeExistingId.id, 0.001f );

                        visitor.startId( startNode, startNodeGroup );
                        visitor.endId( endNode, endNodeGroup );

                        String type = idGenerator.randomType( randoms.random() );
                        if ( randoms.random().nextFloat() < 0.00005 )
                        {
                            // Let there be a small chance of introducing a one-off relationship
                            // with a type that no, or at least very few, other relationships have.
                            type += "_odd";
                        }
                        visitor.type( type );
                    }
                }, 0 ) );
    }

Replace Anonymous With Lambda org.neo4j.unsafe.impl.batchimport.ParallelBatchImporterTest.relationships.replayable.new GeneratingInputIterator<>.new GeneratingInputIterator.Generator<Randoms> with (randoms, visitor, id) -> {randomProperties(randoms,"Name " + id,visitor); in method private relationships(randomSeed long, count long, batchSize int, idGenerator InputIdGenerator, groups IdGroupDistribution) : InputIterable from class org.neo4j.unsafe.impl.batchimport.ParallelBatchImporterTest


    private InputIterable nodes( final long randomSeed, final long count, int batchSize,
            final InputIdGenerator inputIdGenerator, final IdGroupDistribution groups )
    {
        return replayable( () -> new GeneratingInputIterator<>( count, batchSize, new RandomsStates( randomSeed ),
                ( randoms, visitor, id ) -> {
                    Object nodeId = inputIdGenerator.nextNodeId( randoms.random(), id );
                    Group group = groups.groupOf( id );
                    visitor.id( nodeId, group );
                    randomProperties( randoms, uniqueId( group, nodeId ), visitor );
                    visitor.labels( randoms.selection( TOKENS, 0, TOKENS.length, true ) );
                }, 0 ) );
    }

    private InputIterable nodes( final long randomSeed, final long count, int batchSize,
            final InputIdGenerator inputIdGenerator, final IdGroupDistribution groups )
    {
        return replayable( () -> new GeneratingInputIterator<>( count, batchSize, new RandomsStates( randomSeed ),
                new GeneratingInputIterator.Generator<Randoms>()
                {
                    @Override
                    public void accept( Randoms randoms, InputEntityVisitor visitor, long id ) throws IOException
                    {
                        Object nodeId = inputIdGenerator.nextNodeId( randoms.random(), id );
                        Group group = groups.groupOf( id );
                        visitor.id( nodeId, group );
                        randomProperties( randoms, uniqueId( group, nodeId ), visitor );
                        visitor.labels( randoms.selection( TOKENS, 0, TOKENS.length, true ) );
                    }
                }, 0 ) );
    }

Replace Anonymous With Lambda org.neo4j.unsafe.impl.batchimport.ParallelBatchImporterTest.nodes.replayable.new GeneratingInputIterator<>.new GeneratingInputIterator.Generator<Randoms> with (randoms, visitor, id) -> {Object nodeId=inputIdGenerator.nextNodeId(randoms.random(),id); in method private nodes(randomSeed long, count long, batchSize int, inputIdGenerator InputIdGenerator, groups IdGroupDistribution) : InputIterable from class org.neo4j.unsafe.impl.batchimport.ParallelBatchImporterTest


        RandomNodeGenerator( int count )
        {
            super( count, 1_000, new RandomsStates( random.seed() ), ( state, visitor, id ) -> {
                String[] keys = random.randoms().selection( TOKENS, 1, TOKENS.length, false );
                for ( String key : keys )
                {
                    visitor.property( key, randomPropertyValue( state.random() ) );
                }
                visitor.labels( random.randoms().selection( TOKENS, 1, TOKENS.length, false ) );
            }, 0 );
        }

        RandomNodeGenerator( int count )
        {
            super( count, 1_000, new RandomsStates( random.seed() ), new Generator<Randoms>()
            {
                @Override
                public void accept( Randoms state, InputEntityVisitor visitor, long id ) throws IOException
                {
                    String[] keys = random.randoms().selection( TOKENS, 1, TOKENS.length, false );
                    for ( String key : keys )
                    {
                        visitor.property( key, randomPropertyValue( state.random() ) );
                    }
                    visitor.labels( random.randoms().selection( TOKENS, 1, TOKENS.length, false ) );
                }
            }, 0 );
        }

Replace Anonymous With Lambda schema.MultipleIndexPopulationStressIT.RandomNodeGenerator.RandomNodeGenerator.new Generator<Randoms> with (state, visitor, id) -> {String[] keys=random.randoms().selection(TOKENS,1,TOKENS.length,false); in method package RandomNodeGenerator(count int) from class schema.MultipleIndexPopulationStressIT.RandomNodeGenerator


    private Thread newThreadForNodeAction( final long nodeId, final Consumer<Node> nodeConsumer )
    {
        return new Thread( () -> {
            try ( Transaction tx = db.beginTx() )
            {
                Node node = db.getNodeById( nodeId );
                barrier.await();
                nodeConsumer.accept( node );
                tx.success();
            }
            catch ( Exception e )
            {
                ex.set( e );
            }
        } );
    }

    private Thread newThreadForNodeAction( final long nodeId, final Consumer<Node> nodeConsumer )
    {
        return new Thread()
        {
            @Override
            public void run()
            {
                try ( Transaction tx = db.beginTx() )
                {
                    Node node = db.getNodeById( nodeId );
                    barrier.await();
                    nodeConsumer.accept( node );
                    tx.success();
                }
                catch ( Exception e )
                {
                    ex.set( e );
                }
            }
        };
    }

Replace Anonymous With Lambda synchronization.ConcurrentChangesOnEntitiesTest.newThreadForNodeAction.new Thread with () -> {try(Transaction tx=db.beginTx())Node node=db.getNodeById(nodeId); in method private newThreadForNodeAction(nodeId long, nodeConsumer Consumer<Node>) : Thread from class synchronization.ConcurrentChangesOnEntitiesTest


    private Thread newThreadForRelationshipAction( final long relationshipId, final Consumer<Relationship> relConsumer )
    {
        return new Thread( () -> {
            try ( Transaction tx = db.beginTx() )
            {
                Relationship relationship = db.getRelationshipById( relationshipId );
                barrier.await();
                relConsumer.accept( relationship );
                tx.success();
            }
            catch ( Exception e )
            {
                ex.set( e );
            }
        } );
    }

    private Thread newThreadForRelationshipAction( final long relationshipId, final Consumer<Relationship> relConsumer )
    {
        return new Thread()
        {
            @Override
            public void run()
            {
                try ( Transaction tx = db.beginTx() )
                {
                    Relationship relationship = db.getRelationshipById( relationshipId );
                    barrier.await();
                    relConsumer.accept( relationship );
                    tx.success();
                }
                catch ( Exception e )
                {
                    ex.set( e );
                }
            }
        };
    }

Replace Anonymous With Lambda synchronization.ConcurrentChangesOnEntitiesTest.newThreadForRelationshipAction.new Thread with () -> {try(Transaction tx=db.beginTx())Relationship relationship=db.getRelationshipById(relationshipId); in method private newThreadForRelationshipAction(relationshipId long, relConsumer Consumer<Relationship>) : Thread from class synchronization.ConcurrentChangesOnEntitiesTest


    @SuppressWarnings( "EqualsWhichDoesntCheckParameterClass" ) // yes it does
    @Override
    public boolean equals( Object other )
    {
        if ( typeAndSizeEqual( other ) )
        {
            PrimitiveIntObjectHashMap<?> that = (PrimitiveIntObjectHashMap<?>) other;
            IntObjEquality<VALUE> equality = new IntObjEquality<>( that );
            visitEntries( equality );
            return equality.isEqual();
        }
        return false;
    }

    @SuppressWarnings( "EqualsWhichDoesntCheckParameterClass" ) // yes it does
    @Override
    public boolean equals( Object other )
    {
        if ( typeAndSizeEqual( other ) )
        {
            PrimitiveIntObjectHashMap<?> that = (PrimitiveIntObjectHashMap<?>) other;
            IntObjEquality<VALUE> equality = new IntObjEquality<VALUE>( that );
            visitEntries( equality );
            return equality.isEqual();
        }
        return false;
    }

Replace Generic With Diamond IntObjEquality<VALUE> with IntObjEquality<> in method public equals(other Object) : boolean from class org.neo4j.collection.primitive.hopscotch.PrimitiveIntObjectHashMap


    @Override
    public int hashCode()
    {
        HashCodeComputer<VALUE> hash = new HashCodeComputer<>();
        visitEntries( hash );
        return hash.hashCode();
    }

    @Override
    public int hashCode()
    {
        HashCodeComputer<VALUE> hash = new HashCodeComputer<VALUE>();
        visitEntries( hash );
        return hash.hashCode();
    }

Replace Generic With Diamond HashCodeComputer<VALUE> with HashCodeComputer<> in method public hashCode() : int from class org.neo4j.collection.primitive.hopscotch.PrimitiveIntObjectHashMap


    @SuppressWarnings( "EqualsWhichDoesntCheckParameterClass" ) // yes it does
    @Override
    public boolean equals( Object other )
    {
        if ( typeAndSizeEqual( other ) )
        {
            PrimitiveLongObjectHashMap<?> that = (PrimitiveLongObjectHashMap<?>) other;
            LongObjEquality<VALUE> equality = new LongObjEquality<>( that );
            visitEntries( equality );
            return equality.isEqual();
        }
        return false;
    }

    @SuppressWarnings( "EqualsWhichDoesntCheckParameterClass" ) // yes it does
    @Override
    public boolean equals( Object other )
    {
        if ( typeAndSizeEqual( other ) )
        {
            PrimitiveLongObjectHashMap<?> that = (PrimitiveLongObjectHashMap<?>) other;
            LongObjEquality<VALUE> equality = new LongObjEquality<VALUE>( that );
            visitEntries( equality );
            return equality.isEqual();
        }
        return false;
    }

Replace Generic With Diamond LongObjEquality<VALUE> with LongObjEquality<> in method public equals(other Object) : boolean from class org.neo4j.collection.primitive.hopscotch.PrimitiveLongObjectHashMap


        @Override
        public Iterator<T> iterator()
        {
            return new ArrayIterator<>( array );
        }

        @Override
        public Iterator<T> iterator()
        {
            return new ArrayIterator<T>( array );
        }

Replace Generic With Diamond ArrayIterator<T> with ArrayIterator<> in method public iterator() : Iterator<T> from class org.neo4j.server.helpers.PropertyTypeDispatcher.BoxedArray


    /**
     * Loads the extension points of this server extension. Override this method
     * to provide your own, custom way of loading extension points. The default
     * implementation loads {@link PluginPoint} based on methods with the
     * {@link PluginTarget} annotation.
     *
     * @return the collection of {@link PluginPoint}s for this
     *         {@link ServerPlugin}.
     */
    protected Collection<PluginPoint> getDefaultExtensionPoints( PluginPointFactory pluginPointFactory )
    {
        List<PluginPoint> result = new ArrayList<>();
        for ( Method method : getClass().getMethods() )
        {
            PluginTarget target = method.getAnnotation( PluginTarget.class );
            if ( target != null )
            {
                result.add( pluginPointFactory.createFrom( this, method, target.value() ) );
            }
        }
        return result;
    }

    /**
     * Loads the extension points of this server extension. Override this method
     * to provide your own, custom way of loading extension points. The default
     * implementation loads {@link PluginPoint} based on methods with the
     * {@link PluginTarget} annotation.
     *
     * @return the collection of {@link PluginPoint}s for this
     *         {@link ServerPlugin}.
     */
    protected Collection<PluginPoint> getDefaultExtensionPoints( PluginPointFactory pluginPointFactory )
    {
        List<PluginPoint> result = new ArrayList<PluginPoint>();
        for ( Method method : getClass().getMethods() )
        {
            PluginTarget target = method.getAnnotation( PluginTarget.class );
            if ( target != null )
            {
                result.add( pluginPointFactory.createFrom( this, method, target.value() ) );
            }
        }
        return result;
    }

Replace Generic With Diamond ArrayList<PluginPoint> with ArrayList<> in method protected getDefaultExtensionPoints(pluginPointFactory PluginPointFactory) : Collection<PluginPoint> from class org.neo4j.server.plugins.ServerPlugin


    @Name( GET_CONNECTED_NODES )
    @PluginTarget( Node.class )
    public Iterable<Node> getAllConnectedNodes( @Source Node start )
    {
        ArrayList<Node> nodes = new ArrayList<>();

        for ( Relationship rel : start.getRelationships() )
        {
            nodes.add( rel.getOtherNode( start ) );
        }

        return nodes;
    }

    @Name( GET_CONNECTED_NODES )
    @PluginTarget( Node.class )
    public Iterable<Node> getAllConnectedNodes( @Source Node start )
    {
        ArrayList<Node> nodes = new ArrayList<Node>();

        for ( Relationship rel : start.getRelationships() )
        {
            nodes.add( rel.getOtherNode( start ) );
        }

        return nodes;
    }

Replace Generic With Diamond ArrayList<Node> with ArrayList<> in method public getAllConnectedNodes(start Node) : Iterable<Node> from class org.neo4j.server.plugins.Plugin


    private void addShutdownHook()
    {
        shutdownHook = new Thread( () -> {
            log.info( "Neo4j Server shutdown initiated by request" );
            if ( server != null )
            {
                server.stop();
            }
        } );
        Runtime.getRuntime().addShutdownHook( shutdownHook );
    }

    private void addShutdownHook()
    {
        shutdownHook = new Thread()
        {
            @Override
            public void run()
            {
                log.info( "Neo4j Server shutdown initiated by request" );
                if ( server != null )
                {
                    server.stop();
                }
            }
        };
        Runtime.getRuntime().addShutdownHook( shutdownHook );
    }

Replace Anonymous With Lambda org.neo4j.server.ServerBootstrapper.addShutdownHook.new Thread with () -> {log.info("Neo4j Server shutdown initiated by request"); in method private addShutdownHook() : void from class org.neo4j.server.ServerBootstrapper


    private Iterable<SecurityRule> getSecurityRules()
    {
        ArrayList<SecurityRule> rules = new ArrayList<>();

        for ( String classname : config.get( ServerSettings.security_rules ) )
        {
            try
            {
                rules.add( (SecurityRule) Class.forName( classname ).newInstance() );
            }
            catch ( Exception e )
            {
                log.error( "Could not load server security rule [%s], exception details: ", classname, e.getMessage() );
                e.printStackTrace();
            }
        }

        return rules;
    }

    private Iterable<SecurityRule> getSecurityRules()
    {
        ArrayList<SecurityRule> rules = new ArrayList<SecurityRule>();

        for ( String classname : config.get( ServerSettings.security_rules ) )
        {
            try
            {
                rules.add( (SecurityRule) Class.forName( classname ).newInstance() );
            }
            catch ( Exception e )
            {
                log.error( "Could not load server security rule [%s], exception details: ", classname, e.getMessage() );
                e.printStackTrace();
            }
        }

        return rules;
    }

Replace Generic With Diamond ArrayList<SecurityRule> with ArrayList<> in method private getSecurityRules() : Iterable<SecurityRule> from class org.neo4j.server.modules.SecurityRulesModule


    PluginManager( Config serverConfig, Iterable<ServerPlugin> plugins, LogProvider logProvider )
    {
        Map<String, Pair<ServerPlugin, ServerExtender>> extensions = new HashMap<>();
        Log log = logProvider.getLog( getClass() );
        for ( ServerPlugin plugin : plugins )
        {
            PluginPointFactory factory = new PluginPointFactoryImpl();
            final ServerExtender extender = new ServerExtender( factory );
            try
            {
                plugin.loadServerExtender( extender );
            }
            catch ( Exception | LinkageError ex )
            {
                log.warn( "Failed to load plugin [%s]: %s", plugin.toString(), ex.getMessage() );
                continue;
            }
            Pair<ServerPlugin, ServerExtender> old = extensions.put( plugin.name, Pair.of( plugin, extender ) );
            if ( old != null )
            {
                log.warn( String.format( "Extension naming conflict \"%s\" between \"%s\" and \"%s\"", plugin.name,
                        old.first().getClass(), plugin.getClass() ) );
            }
        }
        for ( Pair<ServerPlugin, ServerExtender> extension : extensions.values() )
        {
            log.info( String.format( "Loaded server plugin \"%s\"", extension.first().name ) );
            for ( PluginPoint point : extension.other().all() )
            {
                log.info( String.format( "  %s.%s: %s", point.forType().getSimpleName(), point.name(),
                        point.getDescription() ) );
            }
            this.extensions.put( extension.first().name, extension.other() );
        }
    }

    PluginManager( Config serverConfig, Iterable<ServerPlugin> plugins, LogProvider logProvider )
    {
        Map<String, Pair<ServerPlugin, ServerExtender>> extensions = new HashMap<String, Pair<ServerPlugin, ServerExtender>>();
        Log log = logProvider.getLog( getClass() );
        for ( ServerPlugin plugin : plugins )
        {
            PluginPointFactory factory = new PluginPointFactoryImpl();
            final ServerExtender extender = new ServerExtender( factory );
            try
            {
                plugin.loadServerExtender( extender );
            }
            catch ( Exception ex )
            {
                log.warn( "Failed to load plugin [%s]: %s", plugin.toString(), ex.getMessage() );
                continue;
            }
            catch ( LinkageError err )
            {
                log.warn( "Failed to load plugin [%s]: %s", plugin.toString(), err.getMessage() );
                continue;
            }
            Pair<ServerPlugin, ServerExtender> old = extensions.put( plugin.name, Pair.of( plugin, extender ) );
            if ( old != null )
            {
                log.warn( String.format( "Extension naming conflict \"%s\" between \"%s\" and \"%s\"", plugin.name,
                        old.first().getClass(), plugin.getClass() ) );
            }
        }
        for ( Pair<ServerPlugin, ServerExtender> extension : extensions.values() )
        {
            log.info( String.format( "Loaded server plugin \"%s\"", extension.first().name ) );
            for ( PluginPoint point : extension.other().all() )
            {
                log.info( String.format( "  %s.%s: %s", point.forType().getSimpleName(), point.name(),
                        point.getDescription() ) );
            }
            this.extensions.put( extension.first().name, extension.other() );
        }
    }

Merge Catch [catch(Exception ex), catch(LinkageError err)] to catch(Exception|LinkageError ex) in method package PluginManager(serverConfig Config, plugins Iterable<ServerPlugin>, logProvider LogProvider) from class org.neo4j.server.plugins.PluginManager


    @Override
    public List<ExtensionPointRepresentation> describeAll( String name ) throws PluginLookupException
    {
        ServerExtender extender = extensions.get( name );
        if ( extender == null )
        {
            throw new PluginLookupException( "No such ServerPlugin: \"" + name + "\"" );
        }
        List<ExtensionPointRepresentation> result = new ArrayList<>();
        for ( PluginPoint plugin : extender.all() )
        {
            result.add( describe( plugin ) );
        }
        return result;
    }

    @Override
    public List<ExtensionPointRepresentation> describeAll( String name ) throws PluginLookupException
    {
        ServerExtender extender = extensions.get( name );
        if ( extender == null )
        {
            throw new PluginLookupException( "No such ServerPlugin: \"" + name + "\"" );
        }
        List<ExtensionPointRepresentation> result = new ArrayList<ExtensionPointRepresentation>();
        for ( PluginPoint plugin : extender.all() )
        {
            result.add( describe( plugin ) );
        }
        return result;
    }

Replace Generic With Diamond ArrayList<ExtensionPointRepresentation> with ArrayList<> in method public describeAll(name String) : List<ExtensionPointRepresentation> from class org.neo4j.server.plugins.PluginManager


    @Override
    public <T> Representation invoke( GraphDatabaseAPI graphDb, String name, Class<T> type, String method,
            T context, ParameterList params ) throws PluginLookupException, BadInputException,
            PluginInvocationFailureException, BadPluginInvocationException
    {
        PluginPoint plugin = extension( name, type, method );
        try
        {
            return plugin.invoke( graphDb, context, params );
        }
        catch ( BadInputException | PluginInvocationFailureException | BadPluginInvocationException e )
        {
            throw e;
        }
        catch ( Exception e )
        {
            throw new PluginInvocationFailureException( e );
        }
    }

    @Override
    public <T> Representation invoke( GraphDatabaseAPI graphDb, String name, Class<T> type, String method,
            T context, ParameterList params ) throws PluginLookupException, BadInputException,
            PluginInvocationFailureException, BadPluginInvocationException
    {
        PluginPoint plugin = extension( name, type, method );
        try
        {
            return plugin.invoke( graphDb, context, params );
        }
        catch ( BadInputException e )
        {
            throw e;
        }
        catch ( BadPluginInvocationException e )
        {
            throw e;
        }
        catch ( PluginInvocationFailureException e )
        {
            throw e;
        }
        catch ( Exception e )
        {
            throw new PluginInvocationFailureException( e );
        }
    }

Merge Catch [catch(BadInputException e), catch(BadPluginInvocationException e), catch(PluginInvocationFailureException e)] to catch(BadInputException|PluginInvocationFailureException|BadPluginInvocationException e) in method public invoke(graphDb GraphDatabaseAPI, name String, type Class<T>, method String, context T, params ParameterList) : Representation from class org.neo4j.server.plugins.PluginManager


                        @Override
                        Object convert( Object[] result )
                        {
                            return new HashSet<>( Arrays.asList( result ) );
                        }

                        @Override
                        Object convert( Object[] result )
                        {
                            return new HashSet<Object>( Arrays.asList( result ) );
                        }

Replace Generic With Diamond HashSet<Object> with HashSet<> in method package convert(result Object[]) : Object from class org.neo4j.server.plugins.PluginPointFactoryImpl.parameterExtractor.new ListParameterExtractor


    private static ParameterExtractor parameterExtractor( Type type, Parameter parameter, Description description )
    {
        if ( type instanceof ParameterizedType )
        {
            ParameterizedType paramType = (ParameterizedType) type;
            Class<?> raw = (Class<?>) paramType.getRawType();
            Type componentType = paramType.getActualTypeArguments()[0];
            Class<?> component = null;
            if ( componentType instanceof Class<?> )
            {
                component = (Class<?>) componentType;
            }
            if ( Set.class == raw )
            {
                TypeCaster caster = TYPES.get( component );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, component, parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return new HashSet<>( Arrays.asList( result ) );
                        }
                    };
                }
            }
            else if ( List.class == raw || Collection.class == raw || Iterable.class == raw )
            {
                TypeCaster caster = TYPES.get( component );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, component, parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return Arrays.asList( result );
                        }
                    };
                }
            }
        }
        else if ( type instanceof Class<?> )
        {
            Class<?> raw = (Class<?>) type;
            if ( raw.isArray() )
            {
                TypeCaster caster = TYPES.get( raw.getComponentType() );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, raw.getComponentType(), parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return result;
                        }
                    };
                }
            }
            else
            {
                TypeCaster caster = TYPES.get( raw );
                if ( caster != null )
                {
                    return new ParameterExtractor( caster, raw, parameter, description );
                }
            }
        }
        else if ( type instanceof GenericArrayType )
        {
            GenericArrayType array = (GenericArrayType) type;
            Type component = array.getGenericComponentType();
            if ( component instanceof Class<?> )
            {
                TypeCaster caster = TYPES.get( component );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, (Class<?>) component, parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return result;
                        }
                    };
                }
            }
        }
        throw new IllegalStateException( "Unsupported parameter type: " + type );
    }

    private static ParameterExtractor parameterExtractor( Type type, Parameter parameter, Description description )
    {
        if ( type instanceof ParameterizedType )
        {
            ParameterizedType paramType = (ParameterizedType) type;
            Class<?> raw = (Class<?>) paramType.getRawType();
            Type componentType = paramType.getActualTypeArguments()[0];
            Class<?> component = null;
            if ( componentType instanceof Class<?> )
            {
                component = (Class<?>) componentType;
            }
            if ( Set.class == raw )
            {
                TypeCaster caster = TYPES.get( component );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, component, parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return new HashSet<Object>( Arrays.asList( result ) );
                        }
                    };
                }
            }
            else if ( List.class == raw || Collection.class == raw || Iterable.class == raw )
            {
                TypeCaster caster = TYPES.get( component );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, component, parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return Arrays.asList( result );
                        }
                    };
                }
            }
        }
        else if ( type instanceof Class<?> )
        {
            Class<?> raw = (Class<?>) type;
            if ( raw.isArray() )
            {
                TypeCaster caster = TYPES.get( raw.getComponentType() );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, raw.getComponentType(), parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return result;
                        }
                    };
                }
            }
            else
            {
                TypeCaster caster = TYPES.get( raw );
                if ( caster != null )
                {
                    return new ParameterExtractor( caster, raw, parameter, description );
                }
            }
        }
        else if ( type instanceof GenericArrayType )
        {
            GenericArrayType array = (GenericArrayType) type;
            Type component = array.getGenericComponentType();
            if ( component instanceof Class<?> )
            {
                TypeCaster caster = TYPES.get( component );
                if ( caster != null )
                {
                    return new ListParameterExtractor( caster, (Class<?>) component, parameter, description )
                    {
                        @Override
                        Object convert( Object[] result )
                        {
                            return result;
                        }
                    };
                }
            }
        }
        throw new IllegalStateException( "Unsupported parameter type: " + type );
    }

Replace Generic With Diamond HashSet<Object> with HashSet<> in method private parameterExtractor(type Type, parameter Parameter, description Description) : ParameterExtractor from class org.neo4j.server.plugins.PluginPointFactoryImpl


                @Override
                Representation convert( Object obj )
                {
                    return new PathRepresentation<>( (Path) obj );
                }

                @Override
                Representation convert( Object obj )
                {
                    return new PathRepresentation<Path>( (Path) obj );
                }

Replace Generic With Diamond PathRepresentation<Path> with PathRepresentation<> in method package convert(obj Object) : Representation from class org.neo4j.server.plugins.ResultConverter.PATH_RESULT.new ValueResult


    @GET
    @Path( BEAN_TEMPLATE )
    public Response getBean( @PathParam( "domain" ) String domainName, @PathParam( "objectName" ) String objectName )
    {
        MBeanServer server = ManagementFactory.getPlatformMBeanServer();

        ArrayList<JmxMBeanRepresentation> beans = new ArrayList<>();
        for ( Object objName : server.queryNames( createObjectName( domainName, objectName ), null ) )
        {
            beans.add( new JmxMBeanRepresentation( (ObjectName) objName ) );
        }

        return output.ok( new ListRepresentation( "bean", beans ) );
    }

    @GET
    @Path( BEAN_TEMPLATE )
    public Response getBean( @PathParam( "domain" ) String domainName, @PathParam( "objectName" ) String objectName )
    {
        MBeanServer server = ManagementFactory.getPlatformMBeanServer();

        ArrayList<JmxMBeanRepresentation> beans = new ArrayList<JmxMBeanRepresentation>();
        for ( Object objName : server.queryNames( createObjectName( domainName, objectName ), null ) )
        {
            beans.add( new JmxMBeanRepresentation( (ObjectName) objName ) );
        }

        return output.ok( new ListRepresentation( "bean", beans ) );
    }

Replace Generic With Diamond ArrayList<JmxMBeanRepresentation> with ArrayList<> in method public getBean(domainName String, objectName String) : Response from class org.neo4j.server.rest.management.JmxService


    @POST
    @Consumes( MediaType.APPLICATION_JSON )
    @Path( QUERY_PATH )
    @SuppressWarnings( "unchecked" )
    public Response queryBeans( String query )
    {
        try
        {
            MBeanServer server = ManagementFactory.getPlatformMBeanServer();

            String json = dodgeStartingUnicodeMarker( query );
            Collection<Object> queries = (Collection<Object>) JsonHelper.readJson( json );

            ArrayList<JmxMBeanRepresentation> beans = new ArrayList<>();
            for ( Object queryObj : queries )
            {
                assert queryObj instanceof String;
                for ( Object objName : server.queryNames( new ObjectName( (String) queryObj ), null ) )
                {
                    beans.add( new JmxMBeanRepresentation( (ObjectName) objName ) );
                }
            }

            return output.ok( new ListRepresentation( "jmxBean", beans ) );
        }
        catch ( JsonParseException | MalformedObjectNameException e )
        {
            return output.badRequest( e );
        }
    }

    @POST
    @Consumes( MediaType.APPLICATION_JSON )
    @Path( QUERY_PATH )
    @SuppressWarnings( "unchecked" )
    public Response queryBeans( String query )
    {
        try
        {
            MBeanServer server = ManagementFactory.getPlatformMBeanServer();

            String json = dodgeStartingUnicodeMarker( query );
            Collection<Object> queries = (Collection<Object>) JsonHelper.readJson( json );

            ArrayList<JmxMBeanRepresentation> beans = new ArrayList<JmxMBeanRepresentation>();
            for ( Object queryObj : queries )
            {
                assert queryObj instanceof String;
                for ( Object objName : server.queryNames( new ObjectName( (String) queryObj ), null ) )
                {
                    beans.add( new JmxMBeanRepresentation( (ObjectName) objName ) );
                }
            }

            return output.ok( new ListRepresentation( "jmxBean", beans ) );
        }
        catch ( JsonParseException e )
        {
            return output.badRequest( e );
        }
        catch ( MalformedObjectNameException e )
        {
            return output.badRequest( e );
        }
    }

Merge Catch [catch(JsonParseException e), catch(MalformedObjectNameException e)] to catch(JsonParseException|MalformedObjectNameException e) in method public queryBeans(query String) : Response from class org.neo4j.server.rest.management.JmxService


    @POST
    public Response exec( @Context InputFormat input, String data )
    {
        Map<String, Object> args;
        try
        {
            args = input.readMap( data );
        }
        catch ( BadInputException e )
        {
            return output.badRequest( e );
        }

        if ( !args.containsKey( "command" ) )
        {
            return Response.status( Status.BAD_REQUEST )
                    .entity( "Expected command argument not present." )
                    .build();
        }

        ScriptSession scriptSession;
        try
        {
            scriptSession = getSession( args );
        }
        catch ( IllegalArgumentException e )
        {
            return output.badRequest( e );
        }

        log.debug( scriptSession.toString() );
        try
        {
            Pair<String, String> result = scriptSession.evaluate( (String) args.get( "command" ) );
            List<Representation> list = new ArrayList<>(
                    asList( ValueRepresentation.string( result.first() ), ValueRepresentation.string( result.other() ) ) );

            return output.ok( new ListRepresentation( RepresentationType.STRING, list ) );
        }
        catch ( Exception e )
        {
            List<Representation> list = new ArrayList<>(
                    asList( ValueRepresentation.string( e.getClass() + " : " + e.getMessage() + "\n" ),
                            ValueRepresentation.string( null ) ) );
            return output.ok( new ListRepresentation( RepresentationType.STRING, list ) );
        }
    }

    @POST
    public Response exec( @Context InputFormat input, String data )
    {
        Map<String, Object> args;
        try
        {
            args = input.readMap( data );
        }
        catch ( BadInputException e )
        {
            return output.badRequest( e );
        }

        if ( !args.containsKey( "command" ) )
        {
            return Response.status( Status.BAD_REQUEST )
                    .entity( "Expected command argument not present." )
                    .build();
        }

        ScriptSession scriptSession;
        try
        {
            scriptSession = getSession( args );
        }
        catch ( IllegalArgumentException e )
        {
            return output.badRequest( e );
        }

        log.debug( scriptSession.toString() );
        try
        {
            Pair<String, String> result = scriptSession.evaluate( (String) args.get( "command" ) );
            List<Representation> list = new ArrayList<Representation>(
                    asList( ValueRepresentation.string( result.first() ), ValueRepresentation.string( result.other() ) ) );

            return output.ok( new ListRepresentation( RepresentationType.STRING, list ) );
        }
        catch ( Exception e )
        {
            List<Representation> list = new ArrayList<Representation>(
                    asList( ValueRepresentation.string( e.getClass() + " : " + e.getMessage() + "\n" ),
                            ValueRepresentation.string( null ) ) );
            return output.ok( new ListRepresentation( RepresentationType.STRING, list ) );
        }
    }

Replace Generic With Diamond ArrayList<Representation> with ArrayList<> in method public exec(input InputFormat, data String) : Response from class org.neo4j.server.rest.management.console.ConsoleService


    public ShellSession( GraphDatabaseAPI graph )
    {
        try
        {
            this.log = graph.getDependencyResolver().resolveDependency( LogService.class ).getInternalLog( getClass() );
            ShellServerKernelExtension extension = graph.getDependencyResolver().resolveDependency( KernelExtensions
                    .class ).resolveDependency( ShellServerKernelExtension.class );

            ShellServer server = extension.getServer();
            if ( server == null )
            {
                server = getFallbackServer( graph );
            }
            output = new CollectingOutput();
            client = new SameJvmClient( new HashMap<>(), server, output );
            output.asString();
        }
        catch ( RemoteException | ShellException e )
        {
            throw new RuntimeException( "Unable to start shell client", e );
        }
    }

    public ShellSession( GraphDatabaseAPI graph )
    {
        try
        {
            this.log = graph.getDependencyResolver().resolveDependency( LogService.class ).getInternalLog( getClass() );
            ShellServerKernelExtension extension = graph.getDependencyResolver().resolveDependency( KernelExtensions
                    .class ).resolveDependency( ShellServerKernelExtension.class );

            ShellServer server = extension.getServer();
            if ( server == null )
            {
                server = getFallbackServer( graph );
            }
            output = new CollectingOutput();
            client = new SameJvmClient( new HashMap<String, Serializable>(), server, output );
            output.asString();
        }
        catch ( RemoteException e )
        {
            throw new RuntimeException( "Unable to start shell client", e );
        }
        catch ( ShellException e )
        {
            throw new RuntimeException( "Unable to start shell client", e );
        }
    }

Merge Catch [catch(RemoteException e), catch(ShellException e)] to catch(RemoteException|ShellException e) in method public ShellSession(graph GraphDatabaseAPI) from class org.neo4j.server.rest.management.console.ShellSession


    private Representation dispatchCompositeDataArray( CompositeData[] property, String param )
    {
        ArrayList<Representation> values = new ArrayList<>();
        for ( CompositeData value : property )
        {
            values.add( new JmxCompositeDataRepresentation( value ) );
        }
        return new ListRepresentation( "", values );
    }

    private Representation dispatchCompositeDataArray( CompositeData[] property, String param )
    {
        ArrayList<Representation> values = new ArrayList<Representation>();
        for ( CompositeData value : property )
        {
            values.add( new JmxCompositeDataRepresentation( value ) );
        }
        return new ListRepresentation( "", values );
    }

Replace Generic With Diamond ArrayList<Representation> with ArrayList<> in method private dispatchCompositeDataArray(property CompositeData[], param String) : Representation from class org.neo4j.server.rest.management.repr.JmxAttributeRepresentationDispatcher


    public Map<String, Map<String, String>> serialize()
    {
        HashMap<String, Map<String, String>> result = new HashMap<>();
        result.put( "services", services );
        return result;
    }

    public Map<String, Map<String, String>> serialize()
    {
        HashMap<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
        result.put( "services", services );
        return result;
    }

Replace Generic With Diamond HashMap<String,Map<String,String>> with HashMap<> in method public serialize() : Map<String,Map<String,String>> from class org.neo4j.server.rest.management.repr.ServerRootRepresentation


    private void renderWithLegacyFormat( Throwable exception, MappingSerializer serializer )
    {
        String message = exception.getMessage();
        if ( message != null )
        {
            serializer.putString( "message", message );
        }
        serializer.putString( "exception", exception.getClass().getSimpleName() );
        serializer.putString( "fullname", exception.getClass().getName() );
        StackTraceElement[] trace = exception.getStackTrace();
        if ( trace != null )
        {
            Collection<String> lines = new ArrayList<>( trace.length );
            for ( StackTraceElement element : trace )
            {
                if ( element.toString().matches( ".*(jetty|jersey|sun\\.reflect|mortbay|javax\\.servlet).*" ) )
                {
                    continue;
                }
                lines.add( element.toString() );
            }
            serializer.putList( "stackTrace", ListRepresentation.string( lines ) );
        }

        Throwable cause = exception.getCause();
        if ( cause != null )
        {
            serializer.putMapping( "cause", new ExceptionRepresentation( cause ) );
        }
    }

    private void renderWithLegacyFormat( Throwable exception, MappingSerializer serializer )
    {
        String message = exception.getMessage();
        if ( message != null )
        {
            serializer.putString( "message", message );
        }
        serializer.putString( "exception", exception.getClass().getSimpleName() );
        serializer.putString( "fullname", exception.getClass().getName() );
        StackTraceElement[] trace = exception.getStackTrace();
        if ( trace != null )
        {
            Collection<String> lines = new ArrayList<String>( trace.length );
            for ( StackTraceElement element : trace )
            {
                if ( element.toString().matches( ".*(jetty|jersey|sun\\.reflect|mortbay|javax\\.servlet).*" ) )
                {
                    continue;
                }
                lines.add( element.toString() );
            }
            serializer.putList( "stackTrace", ListRepresentation.string( lines ) );
        }

        Throwable cause = exception.getCause();
        if ( cause != null )
        {
            serializer.putMapping( "cause", new ExceptionRepresentation( cause ) );
        }
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private renderWithLegacyFormat(exception Throwable, serializer MappingSerializer) : void from class org.neo4j.server.rest.repr.ExceptionRepresentation


    public RepresentationFormatRepository( AbstractNeoServer injectorProvider )
    {
        this.injectorProvider = injectorProvider;
        this.formats = new HashMap<>();
        for ( RepresentationFormat format : Service.load( RepresentationFormat.class ) )
        {
            formats.put( format.mediaType, format );
        }
    }

    public RepresentationFormatRepository( AbstractNeoServer injectorProvider )
    {
        this.injectorProvider = injectorProvider;
        this.formats = new HashMap<MediaType, RepresentationFormat>();
        for ( RepresentationFormat format : Service.load( RepresentationFormat.class ) )
        {
            formats.put( format.mediaType, format );
        }
    }

Replace Generic With Diamond HashMap<MediaType,RepresentationFormat> with HashMap<> in method public RepresentationFormatRepository(injectorProvider AbstractNeoServer) from class org.neo4j.server.rest.repr.RepresentationFormatRepository


        EntityExtensionRepresentation()
        {
            super( "entity-extensions" );
            this.extensions = new ArrayList<>();
        }

        EntityExtensionRepresentation()
        {
            super( "entity-extensions" );
            this.extensions = new ArrayList<ExtensionPointRepresentation>();
        }

Replace Generic With Diamond ArrayList<ExtensionPointRepresentation> with ArrayList<> in method package EntityExtensionRepresentation() from class org.neo4j.server.rest.repr.ServerExtensionRepresentation.EntityExtensionRepresentation


        CompactJsonWriter( MappingTemplate template )
        {
            super( new HashMap<>(), true );
            this.template = template;
        }

        CompactJsonWriter( MappingTemplate template )
        {
            super( new HashMap<String, Object>(), true );
            this.template = template;
        }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method package CompactJsonWriter(template MappingTemplate) from class org.neo4j.server.rest.repr.formats.CompactJsonFormat.CompactJsonWriter


        @Override
        protected MappingWriter newMapping( String type, String key )
        {
            Map<String, Object> map = new HashMap<>();
            data.put( key, map );
            return new MapWrappingWriter( map, interactive );
        }

        @Override
        protected MappingWriter newMapping( String type, String key )
        {
            Map<String, Object> map = new HashMap<String, Object>();
            data.put( key, map );
            return new MapWrappingWriter( map, interactive );
        }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method protected newMapping(type String, key String) : MappingWriter from class org.neo4j.server.rest.repr.formats.CompactJsonFormat.CompactJsonWriter


        @Override
        protected ListWriter newList( String type, String key )
        {
            List<Object> list = new ArrayList<>();
            data.put( key, list );
            return new ListWrappingWriter( list, interactive );
        }

        @Override
        protected ListWriter newList( String type, String key )
        {
            List<Object> list = new ArrayList<Object>();
            data.put( key, list );
            return new ListWrappingWriter( list, interactive );
        }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method protected newList(type String, key String) : ListWriter from class org.neo4j.server.rest.repr.formats.CompactJsonFormat.CompactJsonWriter


    @Override
    protected ListWriter serializeList( String type )
    {
        return new ListWrappingWriter( new ArrayList<>() );
    }

    @Override
    protected ListWriter serializeList( String type )
    {
        return new ListWrappingWriter( new ArrayList<Object>() );
    }

Replace Generic With Diamond ListWrappingWriter with ListWrappingWriter in method protected serializeList(type String) : ListWriter from class org.neo4j.server.rest.repr.formats.CompactJsonFormat


        HtmlMap( MappingTemplate template )
        {
            super( new HashMap<>(), true );
            this.template = template;
        }

        HtmlMap( MappingTemplate template )
        {
            super( new HashMap<String, Object>(), true );
            this.template = template;
        }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method package HtmlMap(template MappingTemplate) from class org.neo4j.server.rest.repr.formats.HtmlFormat.HtmlMap


        HtmlList( ListTemplate template )
        {
            super( new ArrayList<>(), true );
            this.template = template;
        }

        HtmlList( ListTemplate template )
        {
            super( new ArrayList<Object>(), true );
            this.template = template;
        }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method package HtmlList(template ListTemplate) from class org.neo4j.server.rest.repr.formats.HtmlFormat.HtmlList


    @Override
    protected MappingWriter serializeMapping( String type )
    {
        return new MapWrappingWriter( new LinkedHashMap<>() );
    }

    @Override
    protected MappingWriter serializeMapping( String type )
    {
        return new MapWrappingWriter( new LinkedHashMap<String, Object>() );
    }

Replace Generic With Diamond MapWrappingWriter with MapWrappingWriter in method protected serializeMapping(type String) : MappingWriter from class org.neo4j.server.rest.repr.formats.JsonFormat


    @Override
    @SuppressWarnings( "unchecked" )
    public List<Object> readList( String input ) throws BadInputException
    {
        try
        {
            return (List<Object>) JsonHelper.readJson( input );
        }
        catch ( ClassCastException | JsonParseException ex )
        {
            throw new BadInputException( ex );
        }
    }

    @Override
    @SuppressWarnings( "unchecked" )
    public List<Object> readList( String input ) throws BadInputException
    {
        try
        {
            return (List<Object>) JsonHelper.readJson( input );
        }
        catch ( ClassCastException ex )
        {
            throw new BadInputException( ex );
        }
        catch ( JsonParseException ex )
        {
            throw new BadInputException( ex );
        }
    }

Merge Catch [catch(ClassCastException ex), catch(JsonParseException ex)] to catch(ClassCastException|JsonParseException ex) in method public readList(input String) : List<Object> from class org.neo4j.server.rest.repr.formats.JsonFormat


    @Override
    protected ListWriter newList( String type )
    {
        List<Object> list = new ArrayList<>();
        data.add( list );
        return new ListWrappingWriter( list, interactive );
    }

    @Override
    protected ListWriter newList( String type )
    {
        List<Object> list = new ArrayList<Object>();
        data.add( list );
        return new ListWrappingWriter( list, interactive );
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method protected newList(type String) : ListWriter from class org.neo4j.server.rest.repr.formats.ListWrappingWriter


    @Override
    protected MappingWriter newMapping( String type )
    {
        Map<String, Object> map = new HashMap<>();
        data.add( map );
        return new MapWrappingWriter( map, interactive );
    }

    @Override
    protected MappingWriter newMapping( String type )
    {
        Map<String, Object> map = new HashMap<String, Object>();
        data.add( map );
        return new MapWrappingWriter( map, interactive );
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method protected newMapping(type String) : MappingWriter from class org.neo4j.server.rest.repr.formats.ListWrappingWriter


    @Override
    protected ListWriter newList( String type, String key )
    {
        List<Object> list = new ArrayList<>();
        data.put( key, list );
        return new ListWrappingWriter( list, interactive );
    }

    @Override
    protected ListWriter newList( String type, String key )
    {
        List<Object> list = new ArrayList<Object>();
        data.put( key, list );
        return new ListWrappingWriter( list, interactive );
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method protected newList(type String, key String) : ListWriter from class org.neo4j.server.rest.repr.formats.MapWrappingWriter


    @Override
    protected MappingWriter newMapping( String type, String key )
    {
        Map<String, Object> map = new HashMap<>();
        data.put( key, map );
        return new MapWrappingWriter( map, interactive );
    }

    @Override
    protected MappingWriter newMapping( String type, String key )
    {
        Map<String, Object> map = new HashMap<String, Object>();
        data.put( key, map );
        return new MapWrappingWriter( map, interactive );
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method protected newMapping(type String, key String) : MappingWriter from class org.neo4j.server.rest.repr.formats.MapWrappingWriter


    @Override
    public Map<String, Object> readMap( final String input, String... requiredKeys ) throws BadInputException
    {
        HashMap<String, Object> result = new HashMap<>();
        if ( input.isEmpty() )
        {
            return result;
        }

        for ( String pair : input.split( "&" ) )
        {
            String[] fields = pair.split( "=" );
            String key;
            String value;

            try
            {
                String charset = StandardCharsets.UTF_8.name();
                key = ensureThatKeyDoesNotHavePhPStyleParenthesesAtTheEnd( URLDecoder.decode( fields[0], charset ) );
                value = URLDecoder.decode( fields[1], charset );
            }
            catch ( UnsupportedEncodingException e )
            {
                throw new BadInputException( e );
            }

            Object old = result.get( key );
            if ( old == null )
            {
                result.put( key, value );
            }
            else
            {
                List<Object> list;
                if ( old instanceof List<?> )
                {
                    list = (List<Object>) old;
                }
                else
                {
                    list = new ArrayList<>();
                    result.put( key, list );
                    list.add( old );
                }
                list.add( value );
            }
        }

        return DefaultFormat.validateKeys( result, requiredKeys );
    }

    @Override
    public Map<String, Object> readMap( final String input, String... requiredKeys ) throws BadInputException
    {
        HashMap<String, Object> result = new HashMap<String, Object>();
        if ( input.isEmpty() )
        {
            return result;
        }

        for ( String pair : input.split( "&" ) )
        {
            String[] fields = pair.split( "=" );
            String key;
            String value;

            try
            {
                String charset = StandardCharsets.UTF_8.name();
                key = ensureThatKeyDoesNotHavePhPStyleParenthesesAtTheEnd( URLDecoder.decode( fields[0], charset ) );
                value = URLDecoder.decode( fields[1], charset );
            }
            catch ( UnsupportedEncodingException e )
            {
                throw new BadInputException( e );
            }

            Object old = result.get( key );
            if ( old == null )
            {
                result.put( key, value );
            }
            else
            {
                List<Object> list;
                if ( old instanceof List<?> )
                {
                    list = (List<Object>) old;
                }
                else
                {
                    list = new ArrayList<>();
                    result.put( key, list );
                    list.add( old );
                }
                list.add( value );
            }
        }

        return DefaultFormat.validateKeys( result, requiredKeys );
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public readMap(input String, requiredKeys String...) : Map<String,Object> from class org.neo4j.server.rest.repr.formats.UrlFormFormat


    private static Iterable<SecurityRule> merge( SecurityRule rule, SecurityRule[] rules )
    {
        ArrayList<SecurityRule> result = new ArrayList<>();

        result.add( rule );

        Collections.addAll( result, rules );

        return result;
    }

    private static Iterable<SecurityRule> merge( SecurityRule rule, SecurityRule[] rules )
    {
        ArrayList<SecurityRule> result = new ArrayList<SecurityRule>();

        result.add( rule );

        Collections.addAll( result, rules );

        return result;
    }

Replace Generic With Diamond ArrayList<SecurityRule> with ArrayList<> in method private merge(rule SecurityRule, rules SecurityRule[]) : Iterable<SecurityRule> from class org.neo4j.server.rest.security.SecurityFilter


    @POST
    @Path( PATH_NODE_EXTENSION_METHOD )
    public Response invokeNodeExtension( @PathParam( "name" ) String name, @PathParam( "method" ) String method,
            @PathParam( "nodeId" ) long nodeId, String data )
    {
        try
        {
            return output.ok( this.invokeNodeExtension( nodeId, name, method, input.readParameterList( data ) ) );
        }
        catch ( NodeNotFoundException | PluginLookupException e )
        {
            return output.notFound( e );
        }
        catch ( BadInputException e )
        {
            return output.badRequest( e );
        }
        catch ( BadPluginInvocationException e )
        {
            return output.badRequest( e.getCause() );
        }
        catch ( PluginInvocationFailureException e )
        {
            return output.serverError( e.getCause() );
        }
        catch ( Exception e )
        {
            return output.serverError( e );
        }
    }

    @POST
    @Path( PATH_NODE_EXTENSION_METHOD )
    public Response invokeNodeExtension( @PathParam( "name" ) String name, @PathParam( "method" ) String method,
            @PathParam( "nodeId" ) long nodeId, String data )
    {
        try
        {
            return output.ok( this.invokeNodeExtension( nodeId, name, method, input.readParameterList( data ) ) );
        }
        catch ( NodeNotFoundException e )
        {
            return output.notFound( e );
        }
        catch ( BadInputException e )
        {
            return output.badRequest( e );
        }
        catch ( PluginLookupException e )
        {
            return output.notFound( e );
        }
        catch ( BadPluginInvocationException e )
        {
            return output.badRequest( e.getCause() );
        }
        catch ( PluginInvocationFailureException e )
        {
            return output.serverError( e.getCause() );
        }
        catch ( Exception e )
        {
            return output.serverError( e );
        }
    }

Merge Catch [catch(NodeNotFoundException e), catch(PluginLookupException e)] to catch(NodeNotFoundException|PluginLookupException e) in method public invokeNodeExtension(name String, method String, nodeId long, data String) : Response from class org.neo4j.server.rest.web.ExtensionService


    @POST
    @Path( PATH_RELATIONSHIP_EXTENSION_METHOD )
    public Response invokeRelationshipExtension( @PathParam( "name" ) String name,
            @PathParam( "method" ) String method, @PathParam( "relationshipId" ) long relationshipId, String data )
    {
        try
        {
            return output.ok( this.invokeRelationshipExtension( relationshipId, name, method,
                    input.readParameterList( data ) ) );
        }
        catch ( RelationshipNotFoundException | PluginLookupException e )
        {
            return output.notFound( e );
        }
        catch ( BadInputException e )
        {
            return output.badRequest( e );
        }
        catch ( BadPluginInvocationException e )
        {
            return output.badRequest( e.getCause() );
        }
        catch ( PluginInvocationFailureException e )
        {
            return output.serverError( e.getCause() );
        }
        catch ( Exception e )
        {
            return output.serverError( e );
        }
    }

    @POST
    @Path( PATH_RELATIONSHIP_EXTENSION_METHOD )
    public Response invokeRelationshipExtension( @PathParam( "name" ) String name,
            @PathParam( "method" ) String method, @PathParam( "relationshipId" ) long relationshipId, String data )
    {
        try
        {
            return output.ok( this.invokeRelationshipExtension( relationshipId, name, method,
                    input.readParameterList( data ) ) );
        }
        catch ( RelationshipNotFoundException e )
        {
            return output.notFound( e );
        }
        catch ( BadInputException e )
        {
            return output.badRequest( e );
        }
        catch ( PluginLookupException e )
        {
            return output.notFound( e );
        }
        catch ( BadPluginInvocationException e )
        {
            return output.badRequest( e.getCause() );
        }
        catch ( PluginInvocationFailureException e )
        {
            return output.serverError( e.getCause() );
        }
        catch ( Exception e )
        {
            return output.serverError( e );
        }
    }

Merge Catch [catch(RelationshipNotFoundException e), catch(PluginLookupException e)] to catch(RelationshipNotFoundException|PluginLookupException e) in method public invokeRelationshipExtension(name String, method String, relationshipId long, data String) : Response from class org.neo4j.server.rest.web.ExtensionService


    @POST
    @Path( PATH_NODES )
    public Response createNode( String body )
    {
        try
        {
            return output.created( actions.createNode( input.readMap( body ) ) );
        }
        catch ( ArrayStoreException ase )
        {
            return generateBadRequestDueToMangledJsonResponse( body );
        }
        catch ( BadInputException | ClassCastException e )
        {
            return output.badRequest( e );
        }
    }

    @POST
    @Path( PATH_NODES )
    public Response createNode( String body )
    {
        try
        {
            return output.created( actions.createNode( input.readMap( body ) ) );
        }
        catch ( ArrayStoreException ase )
        {
            return generateBadRequestDueToMangledJsonResponse( body );
        }
        catch ( BadInputException e )
        {
            return output.badRequest( e );
        }
        catch ( ClassCastException e )
        {
            return output.badRequest( e );
        }
    }

Merge Catch [catch(BadInputException e), catch(ClassCastException e)] to catch(BadInputException|ClassCastException e) in method public createNode(body String) : Response from class org.neo4j.server.rest.web.RestfulGraphDatabase


    @GET
    @Path( PATH_NODE_PROPERTY )
    public Response getNodeProperty( @PathParam( "nodeId" ) long nodeId, @PathParam( "key" ) String key )
    {
        try
        {
            return output.ok( actions.getNodeProperty( nodeId, key ) );
        }
        catch ( NodeNotFoundException | NoSuchPropertyException e )
        {
            return output.notFound( e );
        }
    }

    @GET
    @Path( PATH_NODE_PROPERTY )
    public Response getNodeProperty( @PathParam( "nodeId" ) long nodeId, @PathParam( "key" ) String key )
    {
        try
        {
            return output.ok( actions.getNodeProperty( nodeId, key ) );
        }
        catch ( NodeNotFoundException e )
        {
            return output.notFound( e );
        }
        catch ( NoSuchPropertyException e )
        {
            return output.notFound( e );
        }
    }

Merge Catch [catch(NodeNotFoundException e), catch(NoSuchPropertyException e)] to catch(NodeNotFoundException|NoSuchPropertyException e) in method public getNodeProperty(nodeId long, key String) : Response from class org.neo4j.server.rest.web.RestfulGraphDatabase


    @DELETE
    @Path( PATH_NODE_PROPERTY )
    public Response deleteNodeProperty( @PathParam( "nodeId" ) long nodeId, @PathParam( "key" ) String key )
    {
        try
        {
            actions.removeNodeProperty( nodeId, key );
        }
        catch ( NodeNotFoundException | NoSuchPropertyException e )
        {
            return output.notFound( e );
        }
        return nothing();
    }

    @DELETE
    @Path( PATH_NODE_PROPERTY )
    public Response deleteNodeProperty( @PathParam( "nodeId" ) long nodeId, @PathParam( "key" ) String key )
    {
        try
        {
            actions.removeNodeProperty( nodeId, key );
        }
        catch ( NodeNotFoundException e )
        {
            return output.notFound( e );
        }
        catch ( NoSuchPropertyException e )
        {
            return output.notFound( e );
        }
        return nothing();
    }

Merge Catch [catch(NodeNotFoundException e), catch(NoSuchPropertyException e)] to catch(NodeNotFoundException|NoSuchPropertyException e) in method public deleteNodeProperty(nodeId long, key String) : Response from class org.neo4j.server.rest.web.RestfulGraphDatabase


    @GET
    @Path( PATH_RELATIONSHIP_PROPERTY )
    public Response getRelationshipProperty( @PathParam( "relationshipId" ) long relationshipId,
                                             @PathParam( "key" ) String key )
    {
        try
        {
            return output.ok( actions.getRelationshipProperty( relationshipId, key ) );
        }
        catch ( RelationshipNotFoundException | NoSuchPropertyException e )
        {
            return output.notFound( e );
        }
    }

    @GET
    @Path( PATH_RELATIONSHIP_PROPERTY )
    public Response getRelationshipProperty( @PathParam( "relationshipId" ) long relationshipId,
                                             @PathParam( "key" ) String key )
    {
        try
        {
            return output.ok( actions.getRelationshipProperty( relationshipId, key ) );
        }
        catch ( RelationshipNotFoundException e )
        {
            return output.notFound( e );
        }
        catch ( NoSuchPropertyException e )
        {
            return output.notFound( e );
        }
    }

Merge Catch [catch(RelationshipNotFoundException e), catch(NoSuchPropertyException e)] to catch(RelationshipNotFoundException|NoSuchPropertyException e) in method public getRelationshipProperty(relationshipId long, key String) : Response from class org.neo4j.server.rest.web.RestfulGraphDatabase