    private RecordChange<Long, NeoStoreRecord, Void> getOrLoadNeoStoreRecord()
    {
        if ( neoStoreRecord == null )
        {
            neoStoreRecord = new RecordChanges<>( new RecordChanges.Loader<Long, NeoStoreRecord, Void>()
            {
                @Override
                public NeoStoreRecord newUnused( Long key, Void additionalData )
                {
                    throw new UnsupportedOperationException();
                }

                @Override
                public NeoStoreRecord load( Long key, Void additionalData )
                {
                    return neoStore.asRecord();
                }

                @Override
                public void ensureHeavy( NeoStoreRecord record )
                {
                }
            }, false );
        }
        return neoStoreRecord.getOrLoad( 0L, null );
    }

    private RecordChange<Long, NeoStoreRecord, Void> getOrLoadNeoStoreRecord()
    {
        if ( neoStoreRecord == null )
        {
            neoStoreRecord = new RecordChanges<Long, NeoStoreRecord, Void>(
                    new RecordChanges.Loader<Long, NeoStoreRecord, Void>()
                    {
                        @Override
                        public NeoStoreRecord newUnused( Long key, Void additionalData )
                        {
                            throw new UnsupportedOperationException();
                        }

                        @Override
                        public NeoStoreRecord load( Long key, Void additionalData )
                        {
                            return neoStore.asRecord();
                        }

                        @Override
                        public void ensureHeavy( NeoStoreRecord record )
                        {
                        }
                    }, false );
        }
        return neoStoreRecord.getOrLoad( 0L, null );
    }

Replace Generic With Diamond RecordChanges<Long,NeoStoreRecord,Void> with RecordChanges<> in method private getOrLoadNeoStoreRecord() : RecordChange<Long,NeoStoreRecord,Void> from class org.neo4j.kernel.impl.nioneo.xa.WriteTransaction


    @Override
    public RecordReference<NodeRecord> node( long id )
    {
        return new DirectRecordReference<>( access.getNodeStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<NodeRecord> node( long id )
    {
        return new DirectRecordReference<NodeRecord>( access.getNodeStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<NodeRecord> with DirectRecordReference<> in method public node(id long) : RecordReference<NodeRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<RelationshipRecord> relationship( long id )
    {
        return new DirectRecordReference<>( access.getRelationshipStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<RelationshipRecord> relationship( long id )
    {
        return new DirectRecordReference<RelationshipRecord>( access.getRelationshipStore().forceGetRecord( id ),
                                                              this );
    }

Replace Generic With Diamond DirectRecordReference<RelationshipRecord> with DirectRecordReference<> in method public relationship(id long) : RecordReference<RelationshipRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<PropertyRecord> property( long id )
    {
        return new DirectRecordReference<>( access.getPropertyStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<PropertyRecord> property( long id )
    {
        return new DirectRecordReference<PropertyRecord>( access.getPropertyStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<PropertyRecord> with DirectRecordReference<> in method public property(id long) : RecordReference<PropertyRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<RelationshipTypeTokenRecord> relationshipType( int id )
    {
        return new DirectRecordReference<>( access.getRelationshipTypeTokenStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<RelationshipTypeTokenRecord> relationshipType( int id )
    {
        return new DirectRecordReference<RelationshipTypeTokenRecord>( access.getRelationshipTypeTokenStore().forceGetRecord( id ),
                                                                  this );
    }

Replace Generic With Diamond DirectRecordReference<RelationshipTypeTokenRecord> with DirectRecordReference<> in method public relationshipType(id int) : RecordReference<RelationshipTypeTokenRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<PropertyKeyTokenRecord> propertyKey( int id )
    {
        return new DirectRecordReference<>( access.getPropertyKeyTokenStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<PropertyKeyTokenRecord> propertyKey( int id )
    {
        return new DirectRecordReference<PropertyKeyTokenRecord>( access.getPropertyKeyTokenStore().forceGetRecord( id ),
                                                               this );
    }

Replace Generic With Diamond DirectRecordReference<PropertyKeyTokenRecord> with DirectRecordReference<> in method public propertyKey(id int) : RecordReference<PropertyKeyTokenRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<DynamicRecord> string( long id )
    {
        return new DirectRecordReference<>( access.getStringStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<DynamicRecord> string( long id )
    {
        return new DirectRecordReference<DynamicRecord>( access.getStringStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<DynamicRecord> with DirectRecordReference<> in method public string(id long) : RecordReference<DynamicRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<DynamicRecord> array( long id )
    {
        return new DirectRecordReference<>( access.getArrayStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<DynamicRecord> array( long id )
    {
        return new DirectRecordReference<DynamicRecord>( access.getArrayStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<DynamicRecord> with DirectRecordReference<> in method public array(id long) : RecordReference<DynamicRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<DynamicRecord> relationshipTypeName( int id )
    {
        return new DirectRecordReference<>( access.getRelationshipTypeNameStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<DynamicRecord> relationshipTypeName( int id )
    {
        return new DirectRecordReference<DynamicRecord>( access.getRelationshipTypeNameStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<DynamicRecord> with DirectRecordReference<> in method public relationshipTypeName(id int) : RecordReference<DynamicRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<DynamicRecord> nodeLabels( long id )
    {
        return new DirectRecordReference<>( access.getNodeDynamicLabelStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<DynamicRecord> nodeLabels( long id )
    {
        return new DirectRecordReference<DynamicRecord>( access.getNodeDynamicLabelStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<DynamicRecord> with DirectRecordReference<> in method public nodeLabels(id long) : RecordReference<DynamicRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<LabelTokenRecord> label( int id )
    {
        return new DirectRecordReference<>( access.getLabelTokenStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<LabelTokenRecord> label( int id )
    {
        return new DirectRecordReference<LabelTokenRecord>( access.getLabelTokenStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<LabelTokenRecord> with DirectRecordReference<> in method public label(id int) : RecordReference<LabelTokenRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<DynamicRecord> labelName( int id )
    {
        return new DirectRecordReference<>( access.getLabelNameStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<DynamicRecord> labelName( int id )
    {
        return new DirectRecordReference<DynamicRecord>( access.getLabelNameStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<DynamicRecord> with DirectRecordReference<> in method public labelName(id int) : RecordReference<DynamicRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<DynamicRecord> propertyKeyName( int id )
    {
        return new DirectRecordReference<>( access.getPropertyKeyNameStore().forceGetRecord( id ), this );
    }

    @Override
    public RecordReference<DynamicRecord> propertyKeyName( int id )
    {
        return new DirectRecordReference<DynamicRecord>( access.getPropertyKeyNameStore().forceGetRecord( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<DynamicRecord> with DirectRecordReference<> in method public propertyKeyName(id int) : RecordReference<DynamicRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<NodeRecord> previousNode( long id )
    {
        return new DirectRecordReference<>( access.getNodeStore().forceGetRaw( id ), this );
    }

    @Override
    public RecordReference<NodeRecord> previousNode( long id )
    {
        return new DirectRecordReference<NodeRecord>( access.getNodeStore().forceGetRaw( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<NodeRecord> with DirectRecordReference<> in method public previousNode(id long) : RecordReference<NodeRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<RelationshipRecord> previousRelationship( long id )
    {
        return new DirectRecordReference<>( access.getRelationshipStore().forceGetRaw( id ), this );
    }

    @Override
    public RecordReference<RelationshipRecord> previousRelationship( long id )
    {
        return new DirectRecordReference<RelationshipRecord>( access.getRelationshipStore().forceGetRaw( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<RelationshipRecord> with DirectRecordReference<> in method public previousRelationship(id long) : RecordReference<RelationshipRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<PropertyRecord> previousProperty( long id )
    {
        return new DirectRecordReference<>( access.getPropertyStore().forceGetRaw( id ), this );
    }

    @Override
    public RecordReference<PropertyRecord> previousProperty( long id )
    {
        return new DirectRecordReference<PropertyRecord>( access.getPropertyStore().forceGetRaw( id ), this );
    }

Replace Generic With Diamond DirectRecordReference<PropertyRecord> with DirectRecordReference<> in method public previousProperty(id long) : RecordReference<PropertyRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public RecordReference<NeoStoreRecord> previousGraph()
    {
        return new DirectRecordReference<>( access.getRawNeoStore().asRecord(), this );
    }

    @Override
    public RecordReference<NeoStoreRecord> previousGraph()
    {
        return new DirectRecordReference<NeoStoreRecord>( access.getRawNeoStore().asRecord(), this );
    }

Replace Generic With Diamond DirectRecordReference<NeoStoreRecord> with DirectRecordReference<> in method public previousGraph() : RecordReference<NeoStoreRecord> from class org.neo4j.consistency.store.DirectRecordAccess


    @Override
    public List<WindowPoolStats> getAllWindowPoolStats()
    {
        List<WindowPoolStats> list = new ArrayList<>();
        list.add( getWindowPoolStats() );
        return list;
    }

    @Override
    public List<WindowPoolStats> getAllWindowPoolStats()
    {
        List<WindowPoolStats> list = new ArrayList<WindowPoolStats>();
        list.add( getWindowPoolStats() );
        return list;
    }

Replace Generic With Diamond ArrayList<WindowPoolStats> with ArrayList<> in method public getAllWindowPoolStats() : List<WindowPoolStats> from class org.neo4j.kernel.impl.nioneo.store.NodeStore


    @Override
    public List<WindowPoolStats> getAllWindowPoolStats()
    {
        List<WindowPoolStats> list = new ArrayList<>();
        list.add( stringPropertyStore.getWindowPoolStats() );
        list.add( arrayPropertyStore.getWindowPoolStats() );
        list.add( getWindowPoolStats() );
        return list;
    }

    @Override
    public List<WindowPoolStats> getAllWindowPoolStats()
    {
        List<WindowPoolStats> list = new ArrayList<WindowPoolStats>();
        list.add( stringPropertyStore.getWindowPoolStats() );
        list.add( arrayPropertyStore.getWindowPoolStats() );
        list.add( getWindowPoolStats() );
        return list;
    }

Replace Generic With Diamond ArrayList<WindowPoolStats> with ArrayList<> in method public getAllWindowPoolStats() : List<WindowPoolStats> from class org.neo4j.kernel.impl.nioneo.store.PropertyStore


    public Collection<PropertyRecord> getPropertyRecordChain( long firstRecordId )
    {
        long nextProp = firstRecordId;
        List<PropertyRecord> toReturn = new LinkedList<>();
        if ( nextProp == Record.NO_NEXT_PROPERTY.intValue() )
        {
            return null;
        }
        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            PropertyRecord propRecord = getLightRecord( nextProp );
            toReturn.add(propRecord);
            nextProp = propRecord.getNextProp();
        }
        return toReturn;
    }

    public Collection<PropertyRecord> getPropertyRecordChain( long firstRecordId )
    {
        long nextProp = firstRecordId;
        List<PropertyRecord> toReturn = new LinkedList<PropertyRecord>();
        if ( nextProp == Record.NO_NEXT_PROPERTY.intValue() )
        {
            return null;
        }
        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            PropertyRecord propRecord = getLightRecord( nextProp );
            toReturn.add(propRecord);
            nextProp = propRecord.getNextProp();
        }
        return toReturn;
    }

Replace Generic With Diamond LinkedList<PropertyRecord> with LinkedList<> in method public getPropertyRecordChain(firstRecordId long) : Collection<PropertyRecord> from class org.neo4j.kernel.impl.nioneo.store.PropertyStore


    public Token[] getTokens( int maxCount )
    {
        LinkedList<Token> recordList = new LinkedList<>();
        long maxIdInUse = getHighestPossibleIdInUse();
        int found = 0;
        for ( int i = 0; i <= maxIdInUse && found < maxCount; i++ )
        {
            T record;
            try
            {
                record = getRecord( i );
            }
            catch ( InvalidRecordException t )
            {
                continue;
            }
            found++;
            if ( record != null && record.getNameId() != Record.RESERVED.intValue() )
            {
                String name = getStringFor( record );
                recordList.add( new Token( name, i ) );
            }
        }
        return recordList.toArray( new Token[recordList.size()] );
    }

    public Token[] getTokens( int maxCount )
    {
        LinkedList<Token> recordList = new LinkedList<Token>();
        long maxIdInUse = getHighestPossibleIdInUse();
        int found = 0;
        for ( int i = 0; i <= maxIdInUse && found < maxCount; i++ )
        {
            T record;
            try
            {
                record = getRecord( i );
            }
            catch ( InvalidRecordException t )
            {
                continue;
            }
            found++;
            if ( record != null && record.getNameId() != Record.RESERVED.intValue() )
            {
                String name = getStringFor( record );
                recordList.add( new Token( name, i ) );
            }
        }
        return recordList.toArray( new Token[recordList.size()] );
    }

Replace Generic With Diamond LinkedList<Token> with LinkedList<> in method public getTokens(maxCount int) : Token[] from class org.neo4j.kernel.impl.nioneo.store.TokenStore


        private static NodeRecord readNodeRecord( long id, ReadableByteChannel byteChannel, ByteBuffer buffer )
            throws IOException
        {
            if ( !readAndFlip( byteChannel, buffer, 1 ) )
                return null;
            byte inUseFlag = buffer.get();
            boolean inUse = false;
            if ( inUseFlag == Record.IN_USE.byteValue() )
            {
                inUse = true;
            }
            else if ( inUseFlag != Record.NOT_IN_USE.byteValue() )
            {
                throw new IOException( "Illegal in use flag: " + inUseFlag );
            }
            NodeRecord record;
            if ( inUse )
            {
                if ( !readAndFlip( byteChannel, buffer, 8*3 ) )
                    return null;
                record = new NodeRecord( id, buffer.getLong(), buffer.getLong() );

                // labels
                long labelField = buffer.getLong();
                Collection<DynamicRecord> dynamicLabelRecords = new ArrayList<>();
                readDynamicRecords( byteChannel, buffer, dynamicLabelRecords, COLLECTION_DYNAMIC_RECORD_ADDER );
                record.setLabelField( labelField, dynamicLabelRecords );
            }
            else
                record = new NodeRecord( id, Record.NO_NEXT_RELATIONSHIP.intValue(),
                        Record.NO_NEXT_PROPERTY.intValue() );
            record.setInUse( inUse );
            return record;
        }

        private static NodeRecord readNodeRecord( long id, ReadableByteChannel byteChannel, ByteBuffer buffer )
            throws IOException
        {
            if ( !readAndFlip( byteChannel, buffer, 1 ) )
                return null;
            byte inUseFlag = buffer.get();
            boolean inUse = false;
            if ( inUseFlag == Record.IN_USE.byteValue() )
            {
                inUse = true;
            }
            else if ( inUseFlag != Record.NOT_IN_USE.byteValue() )
            {
                throw new IOException( "Illegal in use flag: " + inUseFlag );
            }
            NodeRecord record;
            if ( inUse )
            {
                if ( !readAndFlip( byteChannel, buffer, 8*3 ) )
                    return null;
                record = new NodeRecord( id, buffer.getLong(), buffer.getLong() );

                // labels
                long labelField = buffer.getLong();
                Collection<DynamicRecord> dynamicLabelRecords = new ArrayList<DynamicRecord>();
                readDynamicRecords( byteChannel, buffer, dynamicLabelRecords, COLLECTION_DYNAMIC_RECORD_ADDER );
                record.setLabelField( labelField, dynamicLabelRecords );
            }
            else
                record = new NodeRecord( id, Record.NO_NEXT_RELATIONSHIP.intValue(),
                        Record.NO_NEXT_PROPERTY.intValue() );
            record.setInUse( inUse );
            return record;
        }

Replace Generic With Diamond ArrayList<DynamicRecord> with ArrayList<> in method private readNodeRecord(id long, byteChannel ReadableByteChannel, buffer ByteBuffer) : NodeRecord from class org.neo4j.kernel.impl.nioneo.xa.Command.NodeCommand


        static Command readFromFile( NeoStore neoStore, IndexingService indexes, ReadableByteChannel byteChannel,
                ByteBuffer buffer ) throws IOException
        {
            Collection<DynamicRecord> records = new ArrayList<>();
            readDynamicRecords( byteChannel, buffer, records, COLLECTION_DYNAMIC_RECORD_ADDER );

            if ( !readAndFlip( byteChannel, buffer, 1 ) )
                throw new IllegalStateException( "Missing SchemaRule.isCreated flag in deserialization" );

            byte isCreated = buffer.get();
            if ( 1 == isCreated )
            {
                for ( DynamicRecord record : records )
                {
                    record.setCreated();
                }
            }

            SchemaRule rule = null;
            if ( first( records ).inUse() )
            {
                ByteBuffer deserialized = AbstractDynamicStore.concatData( records, new byte[100] );
                try
                {
                    rule = SchemaRule.Kind.deserialize( first( records ).getId(), deserialized );
                }
                catch ( MalformedSchemaRuleException e )
                {
                    // TODO This is bad. We should probably just shut down if that happens
                    throw launderedException( e );
                }
            }
            return new SchemaRuleCommand( neoStore != null ? neoStore.getSchemaStore() : null,
                    indexes, records, rule );
        }

        static Command readFromFile( NeoStore neoStore, IndexingService indexes, ReadableByteChannel byteChannel,
                ByteBuffer buffer ) throws IOException
        {
            Collection<DynamicRecord> records = new ArrayList<DynamicRecord>();
            readDynamicRecords( byteChannel, buffer, records, COLLECTION_DYNAMIC_RECORD_ADDER );

            if ( !readAndFlip( byteChannel, buffer, 1 ) )
                throw new IllegalStateException( "Missing SchemaRule.isCreated flag in deserialization" );

            byte isCreated = buffer.get();
            if ( 1 == isCreated )
            {
                for ( DynamicRecord record : records )
                {
                    record.setCreated();
                }
            }

            SchemaRule rule = null;
            if ( first( records ).inUse() )
            {
                ByteBuffer deserialized = AbstractDynamicStore.concatData( records, new byte[100] );
                try
                {
                    rule = SchemaRule.Kind.deserialize( first( records ).getId(), deserialized );
                }
                catch ( MalformedSchemaRuleException e )
                {
                    // TODO This is bad. We should probably just shut down if that happens
                    throw launderedException( e );
                }
            }
            return new SchemaRuleCommand( neoStore != null ? neoStore.getSchemaStore() : null,
                    indexes, records, rule );
        }

Replace Generic With Diamond ArrayList<DynamicRecord> with ArrayList<> in method package readFromFile(neoStore NeoStore, indexes IndexingService, byteChannel ReadableByteChannel, buffer ByteBuffer) : Command from class org.neo4j.kernel.impl.nioneo.xa.Command.SchemaRuleCommand


    public DiffRecordStore( RecordStore<R> actual )
    {
        this.actual = actual;
        this.diff = new HashMap<>();
    }

    public DiffRecordStore( RecordStore<R> actual )
    {
        this.actual = actual;
        this.diff = new HashMap<Long, R>();
    }

Replace Generic With Diamond HashMap<Long,R> with HashMap<> in method public DiffRecordStore(actual RecordStore<R>) from class org.neo4j.consistency.store.DiffRecordStore


    @Override
    public <FAILURE extends Exception> void accept( RecordStore.Processor<FAILURE> processor, R record ) throws FAILURE
    {
        actual.accept( new DispatchProcessor<>( this, processor ), record );
    }

    @Override
    public <FAILURE extends Exception> void accept( RecordStore.Processor<FAILURE> processor, R record ) throws FAILURE
    {
        actual.accept( new DispatchProcessor<FAILURE>( this, processor ), record );
    }

Replace Generic With Diamond DispatchProcessor<FAILURE> with DispatchProcessor<> in method public accept(processor RecordStore.Processor<FAILURE>, record R) : void from class org.neo4j.consistency.store.DiffRecordStore


    @Override
    protected <R extends AbstractBaseRecord> RecordStore<R> wrapStore( RecordStore<R> store )
    {
        return new DiffRecordStore<>( store );
    }

    @Override
    protected <R extends AbstractBaseRecord> RecordStore<R> wrapStore( RecordStore<R> store )
    {
        return new DiffRecordStore<R>( store );
    }

Replace Generic With Diamond DiffRecordStore<R> with DiffRecordStore<> in method protected wrapStore(store RecordStore<R>) : RecordStore<R> from class org.neo4j.consistency.store.DiffStore


    @Test
    public void shouldReportRelationshipLabelNameInconsistencies() throws Exception
    {
        // given
        final Reference<Integer> inconsistentName = new Reference<>();
        fixture.apply( new GraphStoreFixture.Transaction()
        {
            @Override
            protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
                                            GraphStoreFixture.IdGenerator next )
            {
                inconsistentName.set( next.relationshipType() );
                tx.relationshipType( inconsistentName.get(), "FOO" );
            }
        } );
        StoreAccess access = fixture.storeAccess();
        DynamicRecord record = access.getRelationshipTypeNameStore().forceGetRecord( inconsistentName.get() );
        record.setNextBlock( record.getId() );
        access.getRelationshipTypeNameStore().updateRecord( record );

        // when
        ConsistencySummaryStatistics stats = check( access );

        // then
        verifyInconsistency( RecordType.RELATIONSHIP_LABEL_NAME, stats );
    }

    @Test
    public void shouldReportRelationshipLabelNameInconsistencies() throws Exception
    {
        // given
        final Reference<Integer> inconsistentName = new Reference<Integer>();
        fixture.apply( new GraphStoreFixture.Transaction()
        {
            @Override
            protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
                                            GraphStoreFixture.IdGenerator next )
            {
                inconsistentName.set( next.relationshipType() );
                tx.relationshipType( inconsistentName.get(), "FOO" );
            }
        } );
        StoreAccess access = fixture.storeAccess();
        DynamicRecord record = access.getRelationshipTypeNameStore().forceGetRecord( inconsistentName.get() );
        record.setNextBlock( record.getId() );
        access.getRelationshipTypeNameStore().updateRecord( record );

        // when
        ConsistencySummaryStatistics stats = check( access );

        // then
        verifyInconsistency( RecordType.RELATIONSHIP_LABEL_NAME, stats );
    }

Replace Generic With Diamond Reference<Integer> with Reference<> in method public shouldReportRelationshipLabelNameInconsistencies() : void from class org.neo4j.consistency.checking.full.FullCheckIntegrationTest


    @Test
    public void shouldReportPropertyKeyNameInconsistencies() throws Exception
    {
        // given
        final Reference<Integer> inconsistentName = new Reference<>();
        fixture.apply( new GraphStoreFixture.Transaction()
        {
            @Override
            protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
                                            GraphStoreFixture.IdGenerator next )
            {
                inconsistentName.set( next.propertyKey() );
                tx.propertyKey( inconsistentName.get(), "FOO" );
            }
        } );
        StoreAccess access = fixture.storeAccess();
        DynamicRecord record = access.getPropertyKeyNameStore().forceGetRecord( inconsistentName.get() );
        record.setNextBlock( record.getId() );
        access.getPropertyKeyNameStore().updateRecord( record );

        // when
        ConsistencySummaryStatistics stats = check( access );

        // then
        verifyInconsistency( RecordType.PROPERTY_KEY_NAME, stats );
    }

    @Test
    public void shouldReportPropertyKeyNameInconsistencies() throws Exception
    {
        // given
        final Reference<Integer> inconsistentName = new Reference<Integer>();
        fixture.apply( new GraphStoreFixture.Transaction()
        {
            @Override
            protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
                                            GraphStoreFixture.IdGenerator next )
            {
                inconsistentName.set( next.propertyKey() );
                tx.propertyKey( inconsistentName.get(), "FOO" );
            }
        } );
        StoreAccess access = fixture.storeAccess();
        DynamicRecord record = access.getPropertyKeyNameStore().forceGetRecord( inconsistentName.get() );
        record.setNextBlock( record.getId() );
        access.getPropertyKeyNameStore().updateRecord( record );

        // when
        ConsistencySummaryStatistics stats = check( access );

        // then
        verifyInconsistency( RecordType.PROPERTY_KEY_NAME, stats );
    }

Replace Generic With Diamond Reference<Integer> with Reference<> in method public shouldReportPropertyKeyNameInconsistencies() : void from class org.neo4j.consistency.checking.full.FullCheckIntegrationTest


    @Test
    public void shouldReportPropertyKeyInconsistencies() throws Exception
    {
        // given
        final Reference<Integer> inconsistentKey = new Reference<>();
        fixture.apply( new GraphStoreFixture.Transaction()
        {
            @Override
            protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
                                            GraphStoreFixture.IdGenerator next )
            {
                inconsistentKey.set( next.propertyKey() );
                tx.propertyKey( inconsistentKey.get(), "FOO" );
            }
        } );
        StoreAccess access = fixture.storeAccess();
        DynamicRecord record = access.getPropertyKeyNameStore().forceGetRecord( inconsistentKey.get() );
        record.setInUse( false );
        access.getPropertyKeyNameStore().updateRecord( record );

        // when
        ConsistencySummaryStatistics stats = check( access );

        // then
        verifyInconsistency( RecordType.PROPERTY_KEY, stats );
    }

    @Test
    public void shouldReportPropertyKeyInconsistencies() throws Exception
    {
        // given
        final Reference<Integer> inconsistentKey = new Reference<Integer>();
        fixture.apply( new GraphStoreFixture.Transaction()
        {
            @Override
            protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
                                            GraphStoreFixture.IdGenerator next )
            {
                inconsistentKey.set( next.propertyKey() );
                tx.propertyKey( inconsistentKey.get(), "FOO" );
            }
        } );
        StoreAccess access = fixture.storeAccess();
        DynamicRecord record = access.getPropertyKeyNameStore().forceGetRecord( inconsistentKey.get() );
        record.setInUse( false );
        access.getPropertyKeyNameStore().updateRecord( record );

        // when
        ConsistencySummaryStatistics stats = check( access );

        // then
        verifyInconsistency( RecordType.PROPERTY_KEY, stats );
    }

Replace Generic With Diamond Reference<Integer> with Reference<> in method public shouldReportPropertyKeyInconsistencies() : void from class org.neo4j.consistency.checking.full.FullCheckIntegrationTest


            @Override
            public IndexDefinition apply( IndexDescriptor rule )
            {
                try
                {
                    Label label = label( context.labelGetName( state, rule.getLabelId() ) );
                    String propertyKey = context.propertyKeyGetName( state, rule.getPropertyKeyId() );
                    return new IndexDefinitionImpl( actions, label, propertyKey, constraintIndex );
                }
                catch ( LabelNotFoundKernelException | PropertyKeyIdNotFoundException e )
                {
                    throw new RuntimeException( e );
                }
            }

            @Override
            public IndexDefinition apply( IndexDescriptor rule )
            {
                try
                {
                    Label label = label( context.labelGetName( rule.getLabelId() ) );
                    String propertyKey = context.propertyKeyGetName( rule.getPropertyKeyId() );
                    return new IndexDefinitionImpl( actions, label, propertyKey, constraintIndex );
                }
                catch ( LabelNotFoundKernelException e )
                {
                    throw new RuntimeException( e );
                }
                catch ( PropertyKeyIdNotFoundException e )
                {
                    throw new RuntimeException( e );
                }
            }

Merge Catch [catch(LabelNotFoundKernelException e), catch(PropertyKeyIdNotFoundException e)] to catch(LabelNotFoundKernelException|PropertyKeyIdNotFoundException e) in method public apply(rule IndexDescriptor) : IndexDefinition from class org.neo4j.kernel.SchemaImpl.addDefinitions.addToCollection.map.new Function<IndexDescriptor,IndexDefinition>


    public Collection<DynamicRecord> getLightRecords( long startBlockId )
    {
        List<DynamicRecord> recordList = new LinkedList<>();
        long blockId = startBlockId;
        while ( blockId != Record.NO_NEXT_BLOCK.intValue() )
        {
            PersistenceWindow window = acquireWindow( blockId,
                OperationType.READ );
            try
            {
                DynamicRecord record = getRecord( blockId, window, RecordLoad.CHECK );
                recordList.add( record );
                blockId = record.getNextBlock();
            }
            finally
            {
                releaseWindow( window );
            }
        }
        return recordList;
    }

    public Collection<DynamicRecord> getLightRecords( long startBlockId )
    {
        List<DynamicRecord> recordList = new LinkedList<DynamicRecord>();
        long blockId = startBlockId;
        while ( blockId != Record.NO_NEXT_BLOCK.intValue() )
        {
            PersistenceWindow window = acquireWindow( blockId,
                OperationType.READ );
            try
            {
                DynamicRecord record = getRecord( blockId, window, RecordLoad.CHECK );
                recordList.add( record );
                blockId = record.getNextBlock();
            }
            finally
            {
                releaseWindow( window );
            }
        }
        return recordList;
    }

Replace Generic With Diamond LinkedList<DynamicRecord> with LinkedList<> in method public getLightRecords(startBlockId long) : Collection<DynamicRecord> from class org.neo4j.kernel.impl.nioneo.store.AbstractDynamicStore


    public Collection<DynamicRecord> getRecords( long startBlockId )
    {
        List<DynamicRecord> recordList = new LinkedList<>();
        long blockId = startBlockId;
        while ( blockId != Record.NO_NEXT_BLOCK.intValue() )
        {
            PersistenceWindow window = acquireWindow( blockId,
                OperationType.READ );
            try
            {
                DynamicRecord record = getRecord( blockId, window, RecordLoad.NORMAL );
                recordList.add( record );
                blockId = record.getNextBlock();
            }
            finally
            {
                releaseWindow( window );
            }
        }
        return recordList;
    }

    public Collection<DynamicRecord> getRecords( long startBlockId )
    {
        List<DynamicRecord> recordList = new LinkedList<DynamicRecord>();
        long blockId = startBlockId;
        while ( blockId != Record.NO_NEXT_BLOCK.intValue() )
        {
            PersistenceWindow window = acquireWindow( blockId,
                OperationType.READ );
            try
            {
                DynamicRecord record = getRecord( blockId, window, RecordLoad.NORMAL );
                recordList.add( record );
                blockId = record.getNextBlock();
            }
            finally
            {
                releaseWindow( window );
            }
        }
        return recordList;
    }

Replace Generic With Diamond LinkedList<DynamicRecord> with LinkedList<> in method public getRecords(startBlockId long) : Collection<DynamicRecord> from class org.neo4j.kernel.impl.nioneo.store.AbstractDynamicStore


    /**
     * Rebuilds the internal id generator keeping track of what blocks are free
     * or taken.
     */
    @Override
    protected void rebuildIdGenerator()
    {
        if ( getBlockSize() <= 0 )
        {
            throw new InvalidRecordException( "Illegal blockSize: " +
                getBlockSize() );
        }
        stringLogger.debug( "Rebuilding id generator for[" + getStorageFileName() + "] ..." );
        closeIdGenerator();
        if ( fileSystemAbstraction.fileExists( new File( getStorageFileName().getPath() + ".id" )) )
        {
            boolean success = fileSystemAbstraction.deleteFile( new File( getStorageFileName().getPath() + ".id" ));
            assert success;
        }
        createIdGenerator( new File( getStorageFileName().getPath() + ".id" ));
        openIdGenerator();
        setHighId( 1 ); // reserved first block containing blockSize
        FileChannel fileChannel = getFileChannel();
        long highId = 0;
        long defraggedCount = 0;
        try
        {
            long fileSize = fileChannel.size();
            boolean fullRebuild = true;

            if ( conf.get( Configuration.rebuild_idgenerators_fast ) )
            {
                fullRebuild = false;
                highId = findHighIdBackwards();
            }

            ByteBuffer byteBuffer = ByteBuffer.wrap( new byte[1] );
            LinkedList<Long> freeIdList = new LinkedList<>();
            if ( fullRebuild )
            {
                for ( long i = 1; i * getBlockSize() < fileSize; i++ )
                {
                    fileChannel.position( i * getBlockSize() );
                    byteBuffer.clear();
                    fileChannel.read( byteBuffer );
                    byteBuffer.flip();
                    if ( !isRecordInUse( byteBuffer ) )
                    {
                        freeIdList.add( i );
                    }
                    else
                    {
                        highId = i;
                        setHighId( highId + 1 );
                        while ( !freeIdList.isEmpty() )
                        {
                            freeId( freeIdList.removeFirst() );
                            defraggedCount++;
                        }
                    }
                }
            }
        }
        catch ( IOException e )
        {
            throw new UnderlyingStorageException(
                "Unable to rebuild id generator " + getStorageFileName(), e );
        }
        setHighId( highId + 1 );
        stringLogger.debug( "[" + getStorageFileName() + "] high id=" + getHighId()
            + " (defragged=" + defraggedCount + ")" );
        stringLogger.logMessage( getStorageFileName() + " rebuild id generator, highId=" + getHighId() +
                " defragged count=" + defraggedCount, true );
        closeIdGenerator();
        openIdGenerator();
    }

    /**
     * Rebuilds the internal id generator keeping track of what blocks are free
     * or taken.
     */
    @Override
    protected void rebuildIdGenerator()
    {
        if ( getBlockSize() <= 0 )
        {
            throw new InvalidRecordException( "Illegal blockSize: " +
                getBlockSize() );
        }
        stringLogger.debug( "Rebuilding id generator for[" + getStorageFileName() + "] ..." );
        closeIdGenerator();
        if ( fileSystemAbstraction.fileExists( new File( getStorageFileName().getPath() + ".id" )) )
        {
            boolean success = fileSystemAbstraction.deleteFile( new File( getStorageFileName().getPath() + ".id" ));
            assert success;
        }
        createIdGenerator( new File( getStorageFileName().getPath() + ".id" ));
        openIdGenerator();
        setHighId( 1 ); // reserved first block containing blockSize
        FileChannel fileChannel = getFileChannel();
        long highId = 0;
        long defraggedCount = 0;
        try
        {
            long fileSize = fileChannel.size();
            boolean fullRebuild = true;

            if ( conf.get( Configuration.rebuild_idgenerators_fast ) )
            {
                fullRebuild = false;
                highId = findHighIdBackwards();
            }

            ByteBuffer byteBuffer = ByteBuffer.wrap( new byte[1] );
            LinkedList<Long> freeIdList = new LinkedList<Long>();
            if ( fullRebuild )
            {
                for ( long i = 1; i * getBlockSize() < fileSize; i++ )
                {
                    fileChannel.position( i * getBlockSize() );
                    byteBuffer.clear();
                    fileChannel.read( byteBuffer );
                    byteBuffer.flip();
                    if ( !isRecordInUse( byteBuffer ) )
                    {
                        freeIdList.add( i );
                    }
                    else
                    {
                        highId = i;
                        setHighId( highId + 1 );
                        while ( !freeIdList.isEmpty() )
                        {
                            freeId( freeIdList.removeFirst() );
                            defraggedCount++;
                        }
                    }
                }
            }
        }
        catch ( IOException e )
        {
            throw new UnderlyingStorageException(
                "Unable to rebuild id generator " + getStorageFileName(), e );
        }
        setHighId( highId + 1 );
        stringLogger.debug( "[" + getStorageFileName() + "] high id=" + getHighId()
            + " (defragged=" + defraggedCount + ")" );
        stringLogger.logMessage( getStorageFileName() + " rebuild id generator, highId=" + getHighId() +
                " defragged count=" + defraggedCount, true );
        closeIdGenerator();
        openIdGenerator();
    }

Replace Generic With Diamond LinkedList<Long> with LinkedList<> in method protected rebuildIdGenerator() : void from class org.neo4j.kernel.impl.nioneo.store.AbstractDynamicStore


    public Pair<byte[]/*header in the first record*/,byte[]/*all other bytes*/> readFullByteArray(
            Iterable<DynamicRecord> records, PropertyType propertyType )
    {
        byte[] header = null;
        List<byte[]> byteList = new LinkedList<>();
        int totalSize = 0, i = 0;
        for ( DynamicRecord record : records )
        {
            ensureHeavy( record );

            int offset = 0;
            if ( i++ == 0 )
            {   // This is the first one, read out the header separately
                header = propertyType.readDynamicRecordHeader( record.getData() );
                offset = header.length;
            }

            byteList.add( record.getData() );
            totalSize += (record.getData().length-offset);
        }
        byte[] bArray = new byte[totalSize];
        assert header != null : "header should be non-null since records should not be empty";
        int sourceOffset = header.length;
        int offset = 0;
        for ( byte[] currentArray : byteList )
        {
            System.arraycopy( currentArray, sourceOffset, bArray, offset,
                currentArray.length-sourceOffset );
            offset += (currentArray.length-sourceOffset);
            sourceOffset = 0;
        }
        return Pair.of( header, bArray );
    }

    public Pair<byte[]/*header in the first record*/,byte[]/*all other bytes*/> readFullByteArray(
            Iterable<DynamicRecord> records, PropertyType propertyType )
    {
        byte[] header = null;
        List<byte[]> byteList = new LinkedList<byte[]>();
        int totalSize = 0, i = 0;
        for ( DynamicRecord record : records )
        {
            ensureHeavy( record );

            int offset = 0;
            if ( i++ == 0 )
            {   // This is the first one, read out the header separately
                header = propertyType.readDynamicRecordHeader( record.getData() );
                offset = header.length;
            }

            byteList.add( record.getData() );
            totalSize += (record.getData().length-offset);
        }
        byte[] bArray = new byte[totalSize];
        assert header != null : "header should be non-null since records should not be empty";
        int sourceOffset = header.length;
        int offset = 0;
        for ( byte[] currentArray : byteList )
        {
            System.arraycopy( currentArray, sourceOffset, bArray, offset,
                currentArray.length-sourceOffset );
            offset += (currentArray.length-sourceOffset);
            sourceOffset = 0;
        }
        return Pair.of( header, bArray );
    }

Replace Generic With Diamond LinkedList<byte[]> with LinkedList<> in method public readFullByteArray(records Iterable<DynamicRecord>, propertyType PropertyType) : Pair<byte[],byte[]> from class org.neo4j.kernel.impl.nioneo.store.AbstractDynamicStore


    @Override
    public Iterable<IndexDefinition> getIndexes( final Label label )
    {
        StatementContext context = ctxProvider.getCtxForReading();
        try
        {
            List<IndexDefinition> definitions = new ArrayList<>();
            long labelId = context.labelGetForName( label.name() );
            addDefinitions( definitions, context, context.indexesGetForLabel( labelId ), false );
            addDefinitions( definitions, context, context.uniqueIndexesGetForLabel( labelId ), true );
            return definitions;
        }
        catch ( LabelNotFoundKernelException e )
        {
            return emptyList();
        }
        finally
        {
            context.close();
        }
    }

    @Override
    public Iterable<IndexDefinition> getIndexes( final Label label )
    {
        StatementContext context = ctxProvider.getCtxForReading();
        try
        {
            List<IndexDefinition> definitions = new ArrayList<IndexDefinition>();
            long labelId = context.labelGetForName( label.name() );
            addDefinitions( definitions, context, context.indexesGetForLabel( labelId ), false );
            addDefinitions( definitions, context, context.uniqueIndexesGetForLabel( labelId ), true );
            return definitions;
        }
        catch ( LabelNotFoundKernelException e )
        {
            return emptyList();
        }
        finally
        {
            context.close();
        }
    }

Replace Generic With Diamond ArrayList<IndexDefinition> with ArrayList<> in method public getIndexes(label Label) : Iterable<IndexDefinition> from class org.neo4j.kernel.SchemaImpl


    @Override
    public Iterable<IndexDefinition> getIndexes()
    {
        StatementContext context = ctxProvider.getCtxForReading();
        try
        {
            List<IndexDefinition> definitions = new ArrayList<>();
            addDefinitions( definitions, context, context.indexesGetAll(), false );
            addDefinitions( definitions, context, context.uniqueIndexesGetAll(), true );
            return definitions;
        }
        finally
        {
            context.close();
        }
    }

    @Override
    public Iterable<IndexDefinition> getIndexes()
    {
        StatementContext context = ctxProvider.getCtxForReading();
        try
        {
            List<IndexDefinition> definitions = new ArrayList<IndexDefinition>();
            addDefinitions( definitions, context, context.indexesGetAll(), false );
            addDefinitions( definitions, context, context.uniqueIndexesGetAll(), true );
            return definitions;
        }
        finally
        {
            context.close();
        }
    }

Replace Generic With Diamond ArrayList<IndexDefinition> with ArrayList<> in method public getIndexes() : Iterable<IndexDefinition> from class org.neo4j.kernel.SchemaImpl


    @Override
    public void awaitIndexesOnline( long duration, TimeUnit unit )
    {
        long millisLeft = TimeUnit.MILLISECONDS.convert( duration, unit );
        Collection<IndexDefinition> onlineIndexes = new ArrayList<>();

        for ( Iterator<IndexDefinition> iter = getIndexes().iterator(); iter.hasNext(); )
        {
            if ( millisLeft < 0 )
                throw new IllegalStateException( "Expected all indexes to come online within a reasonable time."
                                                 + "Indexes brought online: " + onlineIndexes
                                                 + ". Indexes not guaranteed to be online: " + asCollection( iter ) );

            IndexDefinition index = iter.next();
            long millisBefore = System.currentTimeMillis();
            awaitIndexOnline( index, millisLeft, TimeUnit.MILLISECONDS );
            millisLeft -= System.currentTimeMillis() - millisBefore;

            onlineIndexes.add( index );
        }
    }

    @Override
    public void awaitIndexesOnline( long duration, TimeUnit unit )
    {
        long millisLeft = TimeUnit.MILLISECONDS.convert( duration, unit );
        Collection<IndexDefinition> onlineIndexes = new ArrayList<IndexDefinition>();

        for ( Iterator<IndexDefinition> iter = getIndexes().iterator(); iter.hasNext(); )
        {
            if ( millisLeft < 0 )
                throw new IllegalStateException( "Expected all indexes to come online within a reasonable time."
                                                 + "Indexes brought online: " + onlineIndexes
                                                 + ". Indexes not guaranteed to be online: " + asCollection( iter ) );

            IndexDefinition index = iter.next();
            long millisBefore = System.currentTimeMillis();
            awaitIndexOnline( index, millisLeft, TimeUnit.MILLISECONDS );
            millisLeft -= System.currentTimeMillis() - millisBefore;

            onlineIndexes.add( index );
        }
    }

Replace Generic With Diamond ArrayList<IndexDefinition> with ArrayList<> in method public awaitIndexesOnline(duration long, unit TimeUnit) : void from class org.neo4j.kernel.SchemaImpl


    private Set<String> getAvailableHosts() {
        List<String> hostsToRemove = new ArrayList<>();
        for (Entry<String, Long> entry : hosts.entrySet()) {
            long entryAge = System.currentTimeMillis() - entry.getValue();
            if (entryAge > 10000) {
                hostsToRemove.add(entry.getKey());
            }
        }

        for (String host : hostsToRemove) hosts.remove(host);
        return hosts.keySet();
    }

    private Set<String> getAvailableHosts() {
        List<String> hostsToRemove = new ArrayList<String>();
        for (Entry<String, Long> entry : hosts.entrySet()) {
            long entryAge = System.currentTimeMillis() - entry.getValue();
            if (entryAge > 10000) {
                hostsToRemove.add(entry.getKey());
            }
        }

        for (String host : hostsToRemove) hosts.remove(host);
        return hosts.keySet();
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private getAvailableHosts() : Set<String> from class com.github.ecolabardini.example.ReceiverThread


  private void parseBrowseGroups(final String[] browseGroupsValue) {
    if (browseGroupsValue == null) {
      browseGroups = new ArrayList<>();
    } else {
      browseGroups = Arrays.asList(browseGroupsValue);
    }
  }

  private void parseBrowseGroups(final String[] browseGroupsValue) {
    if (browseGroupsValue == null) {
      browseGroups = new ArrayList<String>();
    } else {
      browseGroups = Arrays.asList(browseGroupsValue);
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private parseBrowseGroups(browseGroupsValue String[]) : void from class org.everit.jira.reporting.plugin.web.ReportingAdminSettingsWebAction


  private void parseReportingGroups(final String[] reportingGroupsValue) {
    if (reportingGroupsValue == null) {
      reportingGroups = new ArrayList<>();
    } else {
      reportingGroups = Arrays.asList(reportingGroupsValue);
    }
  }

  private void parseReportingGroups(final String[] reportingGroupsValue) {
    if (reportingGroupsValue == null) {
      reportingGroups = new ArrayList<String>();
    } else {
      reportingGroups = Arrays.asList(reportingGroupsValue);
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private parseReportingGroups(reportingGroupsValue String[]) : void from class org.everit.jira.reporting.plugin.web.ReportingAdminSettingsWebAction


  private void setBrowseGroups() {
    List<String> browseGroupsNames = (List<String>) reportingSettings
        .get(JTTP_PLUGIN_REPORTING_SETTINGS_KEY_PREFIX
            + JTTP_PLUGIN_REPORTING_SETTINGS_BROWSE_GROUPS);
    browseGroups = new ArrayList<>();
    if (browseGroupsNames != null) {
      browseGroups = browseGroupsNames;
    }
  }

  private void setBrowseGroups() {
    List<String> browseGroupsNames = (List<String>) reportingSettings
        .get(JTTP_PLUGIN_REPORTING_SETTINGS_KEY_PREFIX
            + JTTP_PLUGIN_REPORTING_SETTINGS_BROWSE_GROUPS);
    browseGroups = new ArrayList<String>();
    if (browseGroupsNames != null) {
      browseGroups = browseGroupsNames;
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private setBrowseGroups() : void from class org.everit.jira.reporting.plugin.ReportingPluginImpl


  private void setReportingGroups() {
    List<String> reportingGroupsNames = (List<String>) reportingSettings
        .get(JTTP_PLUGIN_REPORTING_SETTINGS_KEY_PREFIX + JTTP_PLUGIN_REPORTING_SETTINGS_GROUPS);
    reportingGroups = new ArrayList<>();
    if (reportingGroupsNames != null) {
      reportingGroups = reportingGroupsNames;
    }
  }

  private void setReportingGroups() {
    List<String> reportingGroupsNames = (List<String>) reportingSettings
        .get(JTTP_PLUGIN_REPORTING_SETTINGS_KEY_PREFIX + JTTP_PLUGIN_REPORTING_SETTINGS_GROUPS);
    reportingGroups = new ArrayList<String>();
    if (reportingGroupsNames != null) {
      reportingGroups = reportingGroupsNames;
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private setReportingGroups() : void from class org.everit.jira.reporting.plugin.ReportingPluginImpl


  /**
   * Print the converted CSV in the {@link ByteArrayOutputStream}.
   */
  public void printCSV(final ByteArrayOutputStream arrayOutputStream)
      throws IOException {
    convertToCSV();
    ArrayList<String> line = null;
    StringBuffer buffer = null;
    String csvLineElement = null;
    try (BufferedWriter bw = new BufferedWriter(
        new OutputStreamWriter(arrayOutputStream, Charset.forName("UTF-8").newEncoder()))) {
      for (int i = 0; i < csvData.size(); i++) {
        buffer = new StringBuffer();
        line = csvData.get(i);
        for (int j = 0; j < maxRowWidth; j++) {
          if (line.size() > j) {
            csvLineElement = line.get(j);
            if (csvLineElement != null) {
              buffer.append(escapeEmbeddedCharacters(
                  csvLineElement));
            }
          }
          if (j < (maxRowWidth - 1)) {
            buffer.append(DEFAULT_SEPARATOR);
          }
        }

        bw.write(buffer.toString().trim());
        if (i < (csvData.size() - 1)) {
          bw.newLine();
        }
      }
    }

  }

  private ByteArrayOutputStream saveCSVFile()
      throws FileNotFoundException, IOException {

    BufferedWriter bw = null;
    ArrayList<String> line = null;
    StringBuffer buffer = null;
    String csvLineElement = null;
    try {
      ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
      bw = new BufferedWriter(new OutputStreamWriter(arrayOutputStream));

      for (int i = 0; i < csvData.size(); i++) {
        buffer = new StringBuffer();

        line = csvData.get(i);
        for (int j = 0; j < maxRowWidth; j++) {
          if (line.size() > j) {
            csvLineElement = line.get(j);
            if (csvLineElement != null) {
              buffer.append(escapeEmbeddedCharacters(
                  csvLineElement));
            }
          }
          if (j < (maxRowWidth - 1)) {
            buffer.append(DEFAULT_SEPARATOR);
          }
        }

        bw.write(buffer.toString().trim());
        if (i < (csvData.size() - 1)) {
          bw.newLine();
        }
      }
      return arrayOutputStream;
    } finally {
      if (bw != null) {
        bw.flush();
        bw.close();
      }
    }
  }

Try With Resources try(BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(arrayOutputStream,Charset.forName("UTF-8").newEncoder()))) in method public printCSV(arrayOutputStream ByteArrayOutputStream) : void from class org.everit.jira.reporting.plugin.export.ExcelToCsvConverter


  private static List<String> createDefaultColumnsList() {
    List<String> requiredColumns = new ArrayList<>();
    requiredColumns.add(ISSUE_KEY);
    requiredColumns.add(ISSUE_SUMMARY);
    requiredColumns.add(TYPE);
    requiredColumns.add(STATUS);
    requiredColumns.add(ASSIGNEE);
    requiredColumns.add(WORKLOG_DESCRIPTION);
    requiredColumns.add(USER);
    requiredColumns.add(TIME_SPENT);
    return requiredColumns;
  }

  private static List<String> createDefaultColumnsList() {
    List<String> requiredColumns = new ArrayList<String>();
    requiredColumns.add(ISSUE_KEY);
    requiredColumns.add(ISSUE_SUMMARY);
    requiredColumns.add(TYPE);
    requiredColumns.add(STATUS);
    requiredColumns.add(ASSIGNEE);
    requiredColumns.add(WORKLOG_DESCRIPTION);
    requiredColumns.add(USER);
    requiredColumns.add(TIME_SPENT);
    return requiredColumns;
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private createDefaultColumnsList() : List<String> from class org.everit.jira.reporting.plugin.column.WorklogDetailsColumns


  private static void appendIssueAffectedVersions(final ReportSearchParam reportSearchParam,
      final List<String> issueAffectedVersions) {
    ArrayList<String> affectedVersions = new ArrayList<>();
    for (String affectedVersion : issueAffectedVersions) {
      if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.NO_VERSION).equals(affectedVersion)) {
        reportSearchParam.selectNoAffectedVersionIssue(true);
      } else {
        affectedVersions.add(affectedVersion);
      }
    }
    reportSearchParam.issueAffectedVersions(affectedVersions);
  }

  private static void appendIssueAffectedVersions(final ReportSearchParam reportSearchParam,
      final List<String> issueAffectedVersions) {
    ArrayList<String> affectedVersions = new ArrayList<String>();
    for (String affectedVersion : issueAffectedVersions) {
      if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.NO_VERSION).equals(affectedVersion)) {
        reportSearchParam.selectNoAffectedVersionIssue(true);
      } else {
        affectedVersions.add(affectedVersion);
      }
    }
    reportSearchParam.issueAffectedVersions(affectedVersions);
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private appendIssueAffectedVersions(reportSearchParam ReportSearchParam, issueAffectedVersions List<String>) : void from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static void appendIssueAssignees(final ReportSearchParam reportSearchParam,
      final List<String> issueAssignees) {
    ArrayList<String> assignees = new ArrayList<>();
    for (String assignee : issueAssignees) {
      if (JiraTimetrackerUtil.getI18nText(PickerUserDTO.UNASSIGNED_USER_NAME).equals(assignee)) {
        reportSearchParam.selectUnassgined(true);
      } else if (JiraTimetrackerUtil.getI18nText(PickerUserDTO.CURRENT_USER_NAME)
          .equals(assignee)) {
        assignees.add(JiraTimetrackerUtil.getLoggedUserName());
      } else {
        assignees.add(assignee);
      }
    }
    reportSearchParam.issueAssignees(assignees);
  }

  private static void appendIssueAssignees(final ReportSearchParam reportSearchParam,
      final List<String> issueAssignees) {
    ArrayList<String> assignees = new ArrayList<String>();
    for (String assignee : issueAssignees) {
      if (JiraTimetrackerUtil.getI18nText(PickerUserDTO.UNASSIGNED_USER_NAME).equals(assignee)) {
        reportSearchParam.selectUnassgined(true);
      } else if (JiraTimetrackerUtil.getI18nText(PickerUserDTO.CURRENT_USER_NAME)
          .equals(assignee)) {
        assignees.add(JiraTimetrackerUtil.getLoggedUserName());
      } else {
        assignees.add(assignee);
      }
    }
    reportSearchParam.issueAssignees(assignees);
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private appendIssueAssignees(reportSearchParam ReportSearchParam, issueAssignees List<String>) : void from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static void appendIssueComponents(final ReportSearchParam reportSearchParam,
      final List<String> issueComponents) {
    ArrayList<String> components = new ArrayList<>();
    for (String component : issueComponents) {
      if (JiraTimetrackerUtil.getI18nText(PickerComponentDTO.NO_COMPONENT).equals(component)) {
        reportSearchParam.selectNoComponentIssue(true);
      } else {
        components.add(component);
      }
    }
    reportSearchParam.issueComponents(components);
  }

  private static void appendIssueComponents(final ReportSearchParam reportSearchParam,
      final List<String> issueComponents) {
    ArrayList<String> components = new ArrayList<String>();
    for (String component : issueComponents) {
      if (JiraTimetrackerUtil.getI18nText(PickerComponentDTO.NO_COMPONENT).equals(component)) {
        reportSearchParam.selectNoComponentIssue(true);
      } else {
        components.add(component);
      }
    }
    reportSearchParam.issueComponents(components);
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private appendIssueComponents(reportSearchParam ReportSearchParam, issueComponents List<String>) : void from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static void appendIssueFixedVersions(final ReportSearchParam reportSearchParam,
      final List<String> issueFixedVersions) {
    ArrayList<String> fixedVersions = new ArrayList<>();
    for (String fixedVersion : issueFixedVersions) {
      if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.NO_VERSION).equals(fixedVersion)) {
        reportSearchParam.selectNoFixedVersionIssue(true);
      } else if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.RELEASED_VERSION)
          .equals(fixedVersion)) {
        reportSearchParam.selectReleasedFixVersion(true);
      } else if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.UNRELEASED_VERSION)
          .equals(fixedVersion)) {
        reportSearchParam.selectUnreleasedFixVersion(true);
      } else {
        fixedVersions.add(fixedVersion);
      }
    }
    reportSearchParam.issueFixedVersions(fixedVersions);
  }

  private static void appendIssueFixedVersions(final ReportSearchParam reportSearchParam,
      final List<String> issueFixedVersions) {
    ArrayList<String> fixedVersions = new ArrayList<String>();
    for (String fixedVersion : issueFixedVersions) {
      if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.NO_VERSION).equals(fixedVersion)) {
        reportSearchParam.selectNoFixedVersionIssue(true);
      } else if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.RELEASED_VERSION)
          .equals(fixedVersion)) {
        reportSearchParam.selectReleasedFixVersion(true);
      } else if (JiraTimetrackerUtil.getI18nText(PickerVersionDTO.UNRELEASED_VERSION)
          .equals(fixedVersion)) {
        reportSearchParam.selectUnreleasedFixVersion(true);
      } else {
        fixedVersions.add(fixedVersion);
      }
    }
    reportSearchParam.issueFixedVersions(fixedVersions);
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private appendIssueFixedVersions(reportSearchParam ReportSearchParam, issueFixedVersions List<String>) : void from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static void appendIssueReportes(final ReportSearchParam reportSearchParam,
      final List<String> issueReporters) {
    ArrayList<String> reporters = new ArrayList<>();
    for (String reporter : issueReporters) {
      if (PickerUserDTO.CURRENT_USER_NAME.equals(reporter)) {
        reporters.add(JiraTimetrackerUtil.getLoggedUserName());
      } else {
        reporters.add(reporter);
      }
    }
    reportSearchParam.issueReporters(reporters);
  }

  private static void appendIssueReportes(final ReportSearchParam reportSearchParam,
      final List<String> issueReporters) {
    ArrayList<String> reporters = new ArrayList<String>();
    for (String reporter : issueReporters) {
      if (PickerUserDTO.CURRENT_USER_NAME.equals(reporter)) {
        reporters.add(JiraTimetrackerUtil.getLoggedUserName());
      } else {
        reporters.add(reporter);
      }
    }
    reportSearchParam.issueReporters(reporters);
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private appendIssueReportes(reportSearchParam ReportSearchParam, issueReporters List<String>) : void from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static void appendIssueResolution(final ReportSearchParam reportSearchParam,
      final List<String> issueResolutionIds) {
    ArrayList<String> resolutionIds = new ArrayList<>();
    for (String resolutionId : issueResolutionIds) {
      if (VALUE_NEGATIVE_ONE.equals(resolutionId)) {
        reportSearchParam.selectUnresolvedResolution(true);
      } else {
        resolutionIds.add(resolutionId);
      }
    }
    reportSearchParam.issueResolutionIds(resolutionIds);
  }

  private static void appendIssueResolution(final ReportSearchParam reportSearchParam,
      final List<String> issueResolutionIds) {
    ArrayList<String> resolutionIds = new ArrayList<String>();
    for (String resolutionId : issueResolutionIds) {
      if (VALUE_NEGATIVE_ONE.equals(resolutionId)) {
        reportSearchParam.selectUnresolvedResolution(true);
      } else {
        resolutionIds.add(resolutionId);
      }
    }
    reportSearchParam.issueResolutionIds(resolutionIds);
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private appendIssueResolution(reportSearchParam ReportSearchParam, issueResolutionIds List<String>) : void from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static void collectUsersFromParams(final FilterCondition filterCondition,
      final ReportSearchParam reportSearchParam, final ReportingPlugin reportingPlugin) {
    ArrayList<String> users = new ArrayList<>(filterCondition.getUsers());
    JiraAuthenticationContext jiraAuthenticationContext =
        ComponentAccessor.getJiraAuthenticationContext();
    ApplicationUser user = jiraAuthenticationContext.getUser();
    if (!PermissionUtil.hasBrowseUserPermission(user, reportingPlugin)) {
      if ((users.size() == 1) && (users.contains(PickerUserDTO.CURRENT_USER_NAME)
          || users.contains(JiraTimetrackerUtil.getLoggedUserName()))) {
        if (users.remove(PickerUserDTO.CURRENT_USER_NAME)) {
          users.add(JiraTimetrackerUtil.getLoggedUserName());
        }
      } else {
        throw new IllegalArgumentException(NO_BROWSE_PERMISSION);
      }
    } else {
      if (!users.isEmpty() && users.contains(PickerUserDTO.NONE_USER_NAME)) {
        users = ConverterUtil.getUserNamesFromGroup(filterCondition.getGroups());
      } else if (users.remove(PickerUserDTO.CURRENT_USER_NAME)) {
        users.add(JiraTimetrackerUtil.getLoggedUserName());
      }
    }
    reportSearchParam.users(users);
  }

  private static void collectUsersFromParams(final FilterCondition filterCondition,
      final ReportSearchParam reportSearchParam, final ReportingPlugin reportingPlugin) {
    ArrayList<String> users = new ArrayList<String>(filterCondition.getUsers());
    JiraAuthenticationContext jiraAuthenticationContext =
        ComponentAccessor.getJiraAuthenticationContext();
    ApplicationUser user = jiraAuthenticationContext.getUser();
    if (!PermissionUtil.hasBrowseUserPermission(user, reportingPlugin)) {
      if ((users.size() == 1) && (users.contains(PickerUserDTO.CURRENT_USER_NAME)
          || users.contains(JiraTimetrackerUtil.getLoggedUserName()))) {
        if (users.remove(PickerUserDTO.CURRENT_USER_NAME)) {
          users.add(JiraTimetrackerUtil.getLoggedUserName());
        }
      } else {
        throw new IllegalArgumentException(NO_BROWSE_PERMISSION);
      }
    } else {
      if (!users.isEmpty() && users.contains(PickerUserDTO.NONE_USER_NAME)) {
        users = ConverterUtil.getUserNamesFromGroup(filterCondition.getGroups());
      } else if (users.remove(PickerUserDTO.CURRENT_USER_NAME)) {
        users.add(JiraTimetrackerUtil.getLoggedUserName());
      }
    }
    reportSearchParam.users(users);
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private collectUsersFromParams(filterCondition FilterCondition, reportSearchParam ReportSearchParam, reportingPlugin ReportingPlugin) : void from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static List<String> getIssuesKeyByJQL(final String jql)
      throws SearchException,
      JqlParseException {
    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    User loggedInUser = authenticationContext.getLoggedInUser();
    List<String> issuesKeys = new ArrayList<>();
    SearchService searchService = ComponentAccessor.getComponentOfType(SearchService.class);
    ParseResult parseResult = searchService.parseQuery(loggedInUser, jql);
    if (parseResult.isValid()) {
      SearchResults results = searchService.search(loggedInUser,
          parseResult.getQuery(), PagerFilter.getUnlimitedFilter());
      List<Issue> issues = results.getIssues();
      for (Issue issue : issues) {
        issuesKeys.add(issue.getKey());
      }
    } else {
      throw new JqlParseException(null, parseResult.getErrors().toString());
    }
    return issuesKeys;
  }

  private static List<String> getIssuesKeyByJQL(final String jql)
      throws SearchException,
      JqlParseException {
    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    User loggedInUser = authenticationContext.getLoggedInUser();
    List<String> issuesKeys = new ArrayList<String>();
    SearchService searchService = ComponentAccessor.getComponentOfType(SearchService.class);
    ParseResult parseResult = searchService.parseQuery(loggedInUser, jql);
    if (parseResult.isValid()) {
      SearchResults results = searchService.search(loggedInUser,
          parseResult.getQuery(), PagerFilter.getUnlimitedFilter());
      List<Issue> issues = results.getIssues();
      for (Issue issue : issues) {
        issuesKeys.add(issue.getKey());
      }
    } else {
      throw new JqlParseException(null, parseResult.getErrors().toString());
    }
    return issuesKeys;
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private getIssuesKeyByJQL(jql String) : List<String> from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private static ArrayList<String> getUserNamesFromGroup(final List<String> groupNames) {
    ArrayList<String> userNames = new ArrayList<>();
    GroupManager groupManager = ComponentAccessor.getGroupManager();
    for (String groupName : groupNames) {
      Collection<String> userNamesInGroup = groupManager.getUserNamesInGroup(groupName);
      for (String userName : userNamesInGroup) {
        userNames.add(userName.toLowerCase(Locale.getDefault()));
      }
    }
    return userNames;
  }

  private static ArrayList<String> getUserNamesFromGroup(final List<String> groupNames) {
    ArrayList<String> userNames = new ArrayList<String>();
    GroupManager groupManager = ComponentAccessor.getGroupManager();
    for (String groupName : groupNames) {
      Collection<String> userNamesInGroup = groupManager.getUserNamesInGroup(groupName);
      for (String userName : userNamesInGroup) {
        userNames.add(userName.toLowerCase(Locale.getDefault()));
      }
    }
    return userNames;
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private getUserNamesFromGroup(groupNames List<String>) : ArrayList<String> from class org.everit.jira.reporting.plugin.util.ConverterUtil


  private List<Long> createProjects(final ApplicationUser loggedInUser) {
    Collection<Project> projects = ComponentAccessor.getPermissionManager()
        .getProjects(Permissions.BROWSE, loggedInUser);

    List<Long> projectList = new ArrayList<>();
    for (Project project : projects) {
      projectList.add(project.getId());
    }
    return projectList;
  }

  private List<Long> createProjects(final ApplicationUser loggedInUser) {
    Collection<Project> projects = ComponentAccessor.getPermissionManager()
        .getProjects(Permissions.BROWSE, loggedInUser);

    List<Long> projectList = new ArrayList<Long>();
    for (Project project : projects) {
      projectList.add(project.getId());
    }
    return projectList;
  }

Replace Generic With Diamond ArrayList<Long> with ArrayList<> in method private createProjects(loggedInUser ApplicationUser) : List<Long> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private List<EntityCondition> createWorklogQueryExprList(final ApplicationUser user,
      final Calendar startDate, final Calendar endDate) {

    String userKey = user.getKey();

    EntityExpr startExpr = new EntityExpr("startdate",
        EntityOperator.GREATER_THAN_EQUAL_TO, new Timestamp(
            startDate.getTimeInMillis()));
    EntityExpr endExpr = new EntityExpr("startdate",
        EntityOperator.LESS_THAN, new Timestamp(endDate.getTimeInMillis()));
    EntityExpr userExpr = new EntityExpr("author", EntityOperator.EQUALS,
        userKey);

    List<EntityCondition> exprList = new ArrayList<>();
    exprList.add(userExpr);
    exprList.add(startExpr);
    exprList.add(endExpr);
    return exprList;
  }

  private List<EntityCondition> createWorklogQueryExprList(final ApplicationUser user,
      final Calendar startDate, final Calendar endDate) {

    String userKey = user.getKey();

    EntityExpr startExpr = new EntityExpr("startdate",
        EntityOperator.GREATER_THAN_EQUAL_TO, new Timestamp(
            startDate.getTimeInMillis()));
    EntityExpr endExpr = new EntityExpr("startdate",
        EntityOperator.LESS_THAN, new Timestamp(endDate.getTimeInMillis()));
    EntityExpr userExpr = new EntityExpr("author", EntityOperator.EQUALS,
        userKey);

    List<EntityCondition> exprList = new ArrayList<EntityCondition>();
    exprList.add(userExpr);
    exprList.add(startExpr);
    exprList.add(endExpr);
    return exprList;
  }

Replace Generic With Diamond ArrayList<EntityCondition> with ArrayList<> in method private createWorklogQueryExprList(user ApplicationUser, startDate Calendar, endDate Calendar) : List<EntityCondition> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private List<EntityCondition> createWorklogQueryExprListWithPermissionCheck(
      final String selectedUser,
      final ApplicationUser loggedInUser,
      final Calendar startDate, final Calendar endDate) {

    String userKey = ((selectedUser == null) || "".equals(selectedUser))
        ? loggedInUser.getKey() : selectedUser;

    List<Long> projects = createProjects(loggedInUser);

    EntityExpr startExpr = new EntityExpr("startdate",
        EntityOperator.GREATER_THAN_EQUAL_TO, new Timestamp(
            startDate.getTimeInMillis()));
    EntityExpr endExpr = new EntityExpr("startdate",
        EntityOperator.LESS_THAN, new Timestamp(endDate.getTimeInMillis()));
    EntityExpr userExpr = new EntityExpr("author", EntityOperator.EQUALS,
        userKey);
    List<EntityCondition> exprList = new ArrayList<>();
    exprList.add(userExpr);
    exprList.add(startExpr);
    exprList.add(endExpr);

    if (!projects.isEmpty()) {
      EntityExpr projectExpr = new EntityExpr("project", EntityOperator.IN, projects);
      exprList.add(projectExpr);
    }
    return exprList;
  }

  private List<EntityCondition> createWorklogQueryExprListWithPermissionCheck(
      final String selectedUser,
      final ApplicationUser loggedInUser,
      final Calendar startDate, final Calendar endDate) {

    String userKey = ((selectedUser == null) || "".equals(selectedUser))
        ? loggedInUser.getKey() : selectedUser;

    List<Long> projects = createProjects(loggedInUser);

    EntityExpr startExpr = new EntityExpr("startdate",
        EntityOperator.GREATER_THAN_EQUAL_TO, new Timestamp(
            startDate.getTimeInMillis()));
    EntityExpr endExpr = new EntityExpr("startdate",
        EntityOperator.LESS_THAN, new Timestamp(endDate.getTimeInMillis()));
    EntityExpr userExpr = new EntityExpr("author", EntityOperator.EQUALS,
        userKey);
    List<EntityCondition> exprList = new ArrayList<EntityCondition>();
    exprList.add(userExpr);
    exprList.add(startExpr);
    exprList.add(endExpr);

    if (!projects.isEmpty()) {
      EntityExpr projectExpr = new EntityExpr("project", EntityOperator.IN, projects);
      exprList.add(projectExpr);
    }
    return exprList;
  }

Replace Generic With Diamond ArrayList<EntityCondition> with ArrayList<> in method private createWorklogQueryExprListWithPermissionCheck(selectedUser String, loggedInUser ApplicationUser, startDate Calendar, endDate Calendar) : List<EntityCondition> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<MissingsWorklogsDTO> getDates(final String selectedUser, final Date from,
      final Date to,
      final boolean workingHour, final boolean checkNonWorking)
      throws GenericEntityException {
    List<MissingsWorklogsDTO> datesWhereNoWorklog = new ArrayList<>();
    Calendar fromDate = Calendar.getInstance();
    fromDate.setTime(from);
    Calendar toDate = Calendar.getInstance();
    toDate.setTime(to);
    while (!fromDate.after(toDate)) {
      String currentDateString = DateTimeConverterUtil.dateToFixFormatString(fromDate.getTime());
      if (excludeDatesSet.contains(currentDateString)) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check includes - not check weekend
      // check weekend - pass
      if (!includeDatesSet.contains(currentDateString)
          && ((fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
              || (fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY))) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check worklog. if no worklog set result else ++ scanedDate
      DecimalFormat decimalFormat = new DecimalFormat("#.#");

      if (workingHour) {
        double missingsTime = isContainsEnoughWorklog(fromDate.getTime(),
            checkNonWorking);
        if (missingsTime > 0) {
          missingsTime = missingsTime / DateTimeConverterUtil.SECONDS_PER_MINUTE
              / DateTimeConverterUtil.MINUTES_PER_HOUR;
          // BigDecimal bd =
          // new BigDecimal(Double.toString(missingsTime)).setScale(2, RoundingMode.HALF_EVEN);
          // missingsTime = bd.doubleValue();
          datesWhereNoWorklog
              .add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
                  decimalFormat.format(missingsTime)));
        }
      } else {
        if (!isContainsWorklog(fromDate.getTime())) {
          datesWhereNoWorklog.add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
              decimalFormat.format(timeTrackingConfiguration.getHoursPerDay().doubleValue())));
        }
      }

      fromDate.add(Calendar.DATE, 1);

    }
    Collections.reverse(datesWhereNoWorklog);
    return datesWhereNoWorklog;
  }

  @Override
  public List<MissingsWorklogsDTO> getDates(final String selectedUser, final Date from,
      final Date to,
      final boolean workingHour, final boolean checkNonWorking)
      throws GenericEntityException {
    List<MissingsWorklogsDTO> datesWhereNoWorklog = new ArrayList<MissingsWorklogsDTO>();
    Calendar fromDate = Calendar.getInstance();
    fromDate.setTime(from);
    Calendar toDate = Calendar.getInstance();
    toDate.setTime(to);
    while (!fromDate.after(toDate)) {
      String currentDateString = DateTimeConverterUtil.dateToFixFormatString(fromDate.getTime());
      if (excludeDatesSet.contains(currentDateString)) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check includes - not check weekend
      // check weekend - pass
      if (!includeDatesSet.contains(currentDateString)
          && ((fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
              || (fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY))) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check worklog. if no worklog set result else ++ scanedDate
      DecimalFormat decimalFormat = new DecimalFormat("#.#");

      if (workingHour) {
        double missingsTime = isContainsEnoughWorklog(fromDate.getTime(),
            checkNonWorking);
        if (missingsTime > 0) {
          missingsTime = missingsTime / DateTimeConverterUtil.SECONDS_PER_MINUTE
              / DateTimeConverterUtil.MINUTES_PER_HOUR;
          // BigDecimal bd =
          // new BigDecimal(Double.toString(missingsTime)).setScale(2, RoundingMode.HALF_EVEN);
          // missingsTime = bd.doubleValue();
          datesWhereNoWorklog
              .add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
                  decimalFormat.format(missingsTime)));
        }
      } else {
        if (!isContainsWorklog(fromDate.getTime())) {
          datesWhereNoWorklog.add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
              decimalFormat.format(timeTrackingConfiguration.getHoursPerDay().doubleValue())));
        }
      }

      fromDate.add(Calendar.DATE, 1);

    }
    Collections.reverse(datesWhereNoWorklog);
    return datesWhereNoWorklog;
  }

Replace Generic With Diamond ArrayList<MissingsWorklogsDTO> with ArrayList<> in method public getDates(selectedUser String, from Date, to Date, workingHour boolean, checkNonWorking boolean) : List<MissingsWorklogsDTO> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<String> getExcludeDaysOfTheMonth(final Date date) {
    String fixDate = DateTimeConverterUtil.dateToFixFormatString(date);
    List<String> resultexcludeDays = new ArrayList<>();
    for (String exludeDate : excludeDatesSet) {
      // TODO this if not handle the 2013-4-04 date..... this is wrong or
      // not? .... think about it.
      if (exludeDate.startsWith(fixDate.substring(0, DATE_LENGTH))) {
        resultexcludeDays.add(exludeDate.substring(exludeDate.length() - 2));
      }
    }

    return resultexcludeDays;
  }

  @Override
  public List<String> getExcludeDaysOfTheMonth(final Date date) {
    String fixDate = DateTimeConverterUtil.dateToFixFormatString(date);
    List<String> resultexcludeDays = new ArrayList<String>();
    for (String exludeDate : excludeDatesSet) {
      // TODO this if not handle the 2013-4-04 date..... this is wrong or
      // not? .... think about it.
      if (exludeDate.startsWith(fixDate.substring(0, DATE_LENGTH))) {
        resultexcludeDays.add(exludeDate.substring(exludeDate.length() - 2));
      }
    }

    return resultexcludeDays;
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getExcludeDaysOfTheMonth(date Date) : List<String> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<Issue> getIssues() throws GenericEntityException {
    // List<GenericValue> issuesGV = null;
    // issuesGV = ComponentAccessor.getOfBizDelegator().findAll("Issue");
    List<Issue> issues = new ArrayList<>();
    // for (GenericValue issueGV : issuesGV) {
    // issues.add(IssueImpl.getIssueObject(issueGV));
    // }
    return issues;
  }

  @Override
  public List<Issue> getIssues() throws GenericEntityException {
    // List<GenericValue> issuesGV = null;
    // issuesGV = ComponentAccessor.getOfBizDelegator().findAll("Issue");
    List<Issue> issues = new ArrayList<Issue>();
    // for (GenericValue issueGV : issuesGV) {
    // issues.add(IssueImpl.getIssueObject(issueGV));
    // }
    return issues;
  }

Replace Generic With Diamond ArrayList<Issue> with ArrayList<> in method public getIssues() : List<Issue> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<String> getLoggedDaysOfTheMonth(final Date date)
      throws GenericEntityException {
    List<String> resultDays = new ArrayList<>();
    int dayOfMonth = 1;
    Calendar startCalendar = Calendar.getInstance();
    startCalendar.setTime(date);
    startCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
    Date start = startCalendar.getTime();

    while (dayOfMonth <= DateTimeConverterUtil.LAST_DAY_OF_MONTH) {
      if (isContainsWorklog(start)) {
        resultDays.add(Integer.toString(dayOfMonth));
      }
      startCalendar.set(Calendar.DAY_OF_MONTH, ++dayOfMonth);
      start = startCalendar.getTime();
    }

    return resultDays;
  }

  @Override
  public List<String> getLoggedDaysOfTheMonth(final Date date)
      throws GenericEntityException {
    List<String> resultDays = new ArrayList<String>();
    int dayOfMonth = 1;
    Calendar startCalendar = Calendar.getInstance();
    startCalendar.setTime(date);
    startCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
    Date start = startCalendar.getTime();

    while (dayOfMonth <= DateTimeConverterUtil.LAST_DAY_OF_MONTH) {
      if (isContainsWorklog(start)) {
        resultDays.add(Integer.toString(dayOfMonth));
      }
      startCalendar.set(Calendar.DAY_OF_MONTH, ++dayOfMonth);
      start = startCalendar.getTime();
    }

    return resultDays;
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getLoggedDaysOfTheMonth(date Date) : List<String> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<String> getProjectsId() {
    List<String> projectsId = new ArrayList<>();
    List<GenericValue> projectsGV = ComponentAccessor.getOfBizDelegator().findAll("Project");
    for (GenericValue project : projectsGV) {
      projectsId.add(project.getString("id"));
    }
    return projectsId;
  }

  @Override
  public List<String> getProjectsId() {
    List<String> projectsId = new ArrayList<String>();
    List<GenericValue> projectsGV = ComponentAccessor.getOfBizDelegator().findAll("Project");
    for (GenericValue project : projectsGV) {
      projectsId.add(project.getString("id"));
    }
    return projectsId;
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getProjectsId() : List<String> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<EveritWorklog> getWorklogs(final String selectedUser, final Date date,
      final Date finalDate)
      throws ParseException {
    Calendar startDate = DateTimeConverterUtil.setDateToDayStart(date);
    Calendar endDate = (Calendar) startDate.clone();
    if (finalDate == null) {
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    } else {
      endDate = DateTimeConverterUtil.setDateToDayStart(finalDate);
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    }

    List<EveritWorklog> worklogs = new ArrayList<>();

    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser loggedInUser = authenticationContext.getUser();

    String userKey;
    if ((selectedUser == null) || "".equals(selectedUser)) {
      userKey = loggedInUser.getKey();
    } else {
      userKey = ComponentAccessor.getUserUtil().getUserByName(selectedUser).getKey();
    }

    List<EntityCondition> exprList = createWorklogQueryExprListWithPermissionCheck(userKey,
        loggedInUser, startDate, endDate);

    List<GenericValue> worklogGVList = ComponentAccessor.getOfBizDelegator()
        .findByAnd("IssueWorklogView", exprList);

    for (GenericValue worklogGv : worklogGVList) {
      EveritWorklog worklog = new EveritWorklog(worklogGv);
      worklogs.add(worklog);
    }

    Collections.sort(worklogs, EveritWorklogComparator.INSTANCE);
    return worklogs;
  }

  @Override
  public List<EveritWorklog> getWorklogs(final String selectedUser, final Date date,
      final Date finalDate)
      throws ParseException {
    Calendar startDate = DateTimeConverterUtil.setDateToDayStart(date);
    Calendar endDate = (Calendar) startDate.clone();
    if (finalDate == null) {
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    } else {
      endDate = DateTimeConverterUtil.setDateToDayStart(finalDate);
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    }

    List<EveritWorklog> worklogs = new ArrayList<EveritWorklog>();

    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser loggedInUser = authenticationContext.getUser();

    String userKey;
    if ((selectedUser == null) || "".equals(selectedUser)) {
      userKey = loggedInUser.getKey();
    } else {
      userKey = ComponentAccessor.getUserUtil().getUserByName(selectedUser).getKey();
    }

    List<EntityCondition> exprList = createWorklogQueryExprListWithPermissionCheck(userKey,
        loggedInUser, startDate, endDate);

    List<GenericValue> worklogGVList = ComponentAccessor.getOfBizDelegator()
        .findByAnd("IssueWorklogView", exprList);

    for (GenericValue worklogGv : worklogGVList) {
      EveritWorklog worklog = new EveritWorklog(worklogGv);
      worklogs.add(worklog);
    }

    Collections.sort(worklogs, EveritWorklogComparator.INSTANCE);
    return worklogs;
  }

Replace Generic With Diamond ArrayList<EveritWorklog> with ArrayList<> in method public getWorklogs(selectedUser String, date Date, finalDate Date) : List<EveritWorklog> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private void loadJttpBuildProperties() {
    Properties properties = PropertiesUtil.getJttpBuildProperties();

    feedBackEmailTo = properties.getProperty(FEEDBACK_EMAIL_TO);

    piwikPorpeties = new HashMap<>();
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_HOST,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_HOST));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_TIMETRACKER_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_TIMETRACKER_SITEID));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_WORKLOGS_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_WORKLOGS_SITEID));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_CHART_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_CHART_SITEID));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_TABLE_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_TABLE_SITEID));
  }

  private void loadJttpBuildProperties() {
    Properties properties = PropertiesUtil.getJttpBuildProperties();

    feedBackEmailTo = properties.getProperty(FEEDBACK_EMAIL_TO);

    piwikPorpeties = new HashMap<String, String>();
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_HOST,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_HOST));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_TIMETRACKER_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_TIMETRACKER_SITEID));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_WORKLOGS_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_WORKLOGS_SITEID));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_CHART_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_CHART_SITEID));
    piwikPorpeties.put(PiwikPropertiesUtil.PIWIK_TABLE_SITEID,
        properties.getProperty(PiwikPropertiesUtil.PIWIK_TABLE_SITEID));
  }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private loadJttpBuildProperties() : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private void removeNonWorkingIssues(final List<GenericValue> worklogGVList) {
    List<GenericValue> worklogsCopy = new ArrayList<>(worklogGVList);
    // if we have non-estimated issues

    // TODO FIXME summaryFilteredIssuePatterns rename nonworking
    // pattern
    if ((nonWorkingIssuePatterns != null) && !nonWorkingIssuePatterns.isEmpty()) {
      IssueManager issueManager = ComponentAccessor.getIssueManager();
      for (GenericValue worklog : worklogsCopy) {
        Long issueId = worklog.getLong("issue");
        MutableIssue issue = issueManager.getIssueObject(issueId);
        for (Pattern issuePattern : nonWorkingIssuePatterns) {
          boolean issueMatches = issuePattern.matcher(issue.getKey()).matches();
          // if match not count in summary
          if (issueMatches) {
            worklogGVList.remove(worklog);
            break;
          }
        }
      }
    }
  }

  private void removeNonWorkingIssues(final List<GenericValue> worklogGVList) {
    List<GenericValue> worklogsCopy = new ArrayList<GenericValue>(worklogGVList);
    // if we have non-estimated issues

    // TODO FIXME summaryFilteredIssuePatterns rename nonworking
    // pattern
    if ((nonWorkingIssuePatterns != null) && !nonWorkingIssuePatterns.isEmpty()) {
      IssueManager issueManager = ComponentAccessor.getIssueManager();
      for (GenericValue worklog : worklogsCopy) {
        Long issueId = worklog.getLong("issue");
        MutableIssue issue = issueManager.getIssueObject(issueId);
        for (Pattern issuePattern : nonWorkingIssuePatterns) {
          boolean issueMatches = issuePattern.matcher(issue.getKey()).matches();
          // if match not count in summary
          if (issueMatches) {
            worklogGVList.remove(worklog);
            break;
          }
        }
      }
    }
  }

Replace Generic With Diamond ArrayList<GenericValue> with ArrayList<> in method private removeNonWorkingIssues(worklogGVList List<GenericValue>) : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private void setCollectorIssuePatterns() {
    List<String> tempIssuePatternList = (List<String>) globalSettings.get(
        GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_NON_ESTIMATED_ISSUES);
    if (tempIssuePatternList != null) {
      // add collector issues
      collectorIssuePatterns = new ArrayList<>();
      for (String tempIssuePattern : tempIssuePatternList) {
        collectorIssuePatterns.add(Pattern.compile(tempIssuePattern));
      }
    } else {
      collectorIssuePatterns = defaultNonEstimedIssuePatterns;
    }
  }

  private void setCollectorIssuePatterns() {
    List<String> tempIssuePatternList = (List<String>) globalSettings.get(
        GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_NON_ESTIMATED_ISSUES);
    if (tempIssuePatternList != null) {
      // add collector issues
      collectorIssuePatterns = new ArrayList<Pattern>();
      for (String tempIssuePattern : tempIssuePatternList) {
        collectorIssuePatterns.add(Pattern.compile(tempIssuePattern));
      }
    } else {
      collectorIssuePatterns = defaultNonEstimedIssuePatterns;
    }
  }

Replace Generic With Diamond ArrayList<Pattern> with ArrayList<> in method private setCollectorIssuePatterns() : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  /**
   * Set the default values of the important variables.
   */
  private void setDefaultVariablesValue() {
    // DEFAULT 20:00
    issueCheckTimeInMinutes = DEFAULT_CHECK_TIME_IN_MINUTES;
    // Default exclude and include dates set are empty. No DATA!!
    // Default: no non working issue. we simple use the empty list
    // defaultNonWorkingIssueIds = new ArrayList<Long>();
    // The default non estimted issues regex. All issue non estimeted.
    defaultNonEstimedIssuePatterns = new ArrayList<>();
    defaultNonEstimedIssuePatterns.add(Pattern.compile(".*"));
  }

  /**
   * Set the default values of the important variables.
   */
  private void setDefaultVariablesValue() {
    // DEFAULT 20:00
    issueCheckTimeInMinutes = DEFAULT_CHECK_TIME_IN_MINUTES;
    // Default exclude and include dates set are empty. No DATA!!
    // Default: no non working issue. we simple use the empty list
    // defaultNonWorkingIssueIds = new ArrayList<Long>();
    // The default non estimted issues regex. All issue non estimeted.
    defaultNonEstimedIssuePatterns = new ArrayList<Pattern>();
    defaultNonEstimedIssuePatterns.add(Pattern.compile(".*"));
  }

Replace Generic With Diamond ArrayList<Pattern> with ArrayList<> in method private setDefaultVariablesValue() : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private void setExcludeDates() {
    String tempSpecialDates = (String) globalSettings.get(
        GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_EXCLUDE_DATES);
    excludeDatesSet = new HashSet<>();
    excludeDatesString = "";
    if (tempSpecialDates != null) {
      excludeDatesString = tempSpecialDates;
      for (String excludeDate : excludeDatesString.split(",")) {
        excludeDatesSet.add(excludeDate);
      }
    }
  }

  private void setExcludeDates() {
    String tempSpecialDates = (String) globalSettings.get(
        GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_EXCLUDE_DATES);
    excludeDatesSet = new HashSet<String>();
    excludeDatesString = "";
    if (tempSpecialDates != null) {
      excludeDatesString = tempSpecialDates;
      for (String excludeDate : excludeDatesString.split(",")) {
        excludeDatesSet.add(excludeDate);
      }
    }
  }

Replace Generic With Diamond HashSet<String> with HashSet<> in method private setExcludeDates() : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl