diff --git a/build/checkstyle.xml b/build/checkstyle.xml index 2d0ec57802c08..9f505b6b31391 100644 --- a/build/checkstyle.xml +++ b/build/checkstyle.xml @@ -96,6 +96,9 @@ + + + diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/RequiredTransportEncryptionIT.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/RequiredTransportEncryptionIT.java index 25b5f12605c44..55e6963caabd0 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/RequiredTransportEncryptionIT.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/RequiredTransportEncryptionIT.java @@ -49,9 +49,9 @@ public class RequiredTransportEncryptionIT public Neo4jWithSocket server = new Neo4jWithSocket( getClass(), settings -> { - Setting encryption_level = + Setting encryptionLevel = new BoltConnector( DEFAULT_CONNECTOR_KEY ).encryption_level; - settings.put( encryption_level.name(), REQUIRED.name() ); + settings.put( encryptionLevel.name(), REQUIRED.name() ); } ); @Parameterized.Parameter( 0 ) diff --git a/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/FibonacciHeap.java b/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/FibonacciHeap.java index d2afee299864b..4415dbf19ee73 100644 --- a/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/FibonacciHeap.java +++ b/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/FibonacciHeap.java @@ -231,10 +231,10 @@ protected void consolidate() // arraySize = (int) Math.log( (double) nrNodes )+1; // FibonacciHeapNode[] A = (FibonacciHeapNode[]) new Object[arraySize]; // FibonacciHeapNode[] A = new FibonacciHeapNode[arraySize]; - ArrayList A = new ArrayList<>( arraySize ); + ArrayList nodes = new ArrayList<>( arraySize ); for ( int i = 0; i < arraySize; ++i ) { - A.add( null ); + nodes.add( null ); } List rootNodes = new LinkedList<>(); rootNodes.add( minimum ); @@ -250,9 +250,9 @@ protected void consolidate() continue; } int d = node.degree; - while ( A.get( d ) != null ) + while ( nodes.get( d ) != null ) { - FibonacciHeapNode y = A.get( d ); + FibonacciHeapNode y = nodes.get( d ); // swap? if ( keyComparator.compare( node.key, y.key ) > 0 ) { @@ -261,15 +261,15 @@ protected void consolidate() y = tmp; } link( y, node ); - A.set( d, null ); + nodes.set( d, null ); ++d; } - A.set( d, node ); + nodes.set( d, node ); } // throw away the root list minimum = null; // and rebuild it from A - for ( FibonacciHeapNode node : A ) + for ( FibonacciHeapNode node : nodes ) { if ( node != null ) { diff --git a/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/GeoEstimateEvaluator.java b/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/GeoEstimateEvaluator.java index d062f8b5cb1c7..1aff0cccd816e 100644 --- a/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/GeoEstimateEvaluator.java +++ b/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/GeoEstimateEvaluator.java @@ -66,14 +66,14 @@ private double distance( double latitude1, double longitude1, latitude2 = Math.toRadians( latitude2 ); longitude2 = Math.toRadians( longitude2 ); double cLa1 = Math.cos( latitude1 ); - double x_A = EARTH_RADIUS * cLa1 * Math.cos( longitude1 ); - double y_A = EARTH_RADIUS * cLa1 * Math.sin( longitude1 ); - double z_A = EARTH_RADIUS * Math.sin( latitude1 ); + double xA = EARTH_RADIUS * cLa1 * Math.cos( longitude1 ); + double yA = EARTH_RADIUS * cLa1 * Math.sin( longitude1 ); + double zA = EARTH_RADIUS * Math.sin( latitude1 ); double cLa2 = Math.cos( latitude2 ); - double x_B = EARTH_RADIUS * cLa2 * Math.cos( longitude2 ); - double y_B = EARTH_RADIUS * cLa2 * Math.sin( longitude2 ); - double z_B = EARTH_RADIUS * Math.sin( latitude2 ); - return Math.sqrt( ( x_A - x_B ) * ( x_A - x_B ) + ( y_A - y_B ) - * ( y_A - y_B ) + ( z_A - z_B ) * ( z_A - z_B ) ); + double xB = EARTH_RADIUS * cLa2 * Math.cos( longitude2 ); + double yB = EARTH_RADIUS * cLa2 * Math.sin( longitude2 ); + double zB = EARTH_RADIUS * Math.sin( latitude2 ); + return Math.sqrt( ( xA - xB ) * ( xA - xB ) + ( yA - yB ) + * ( yA - yB ) + ( zA - zB ) * ( zA - zB ) ); } } diff --git a/community/graph-algo/src/test/java/org/neo4j/graphalgo/path/TestAStar.java b/community/graph-algo/src/test/java/org/neo4j/graphalgo/path/TestAStar.java index 1866550ddf3d5..013c88e625cf3 100644 --- a/community/graph-algo/src/test/java/org/neo4j/graphalgo/path/TestAStar.java +++ b/community/graph-algo/src/test/java/org/neo4j/graphalgo/path/TestAStar.java @@ -247,9 +247,9 @@ public void betterTentativePath() graph.makeEdge( "3", "4", "weight", 0.013d ); // WHEN - WeightedPath best1_4 = finder.findSinglePath( node1, node4 ); + WeightedPath best14 = finder.findSinglePath( node1, node4 ); // THEN - assertPath( best1_4, node1, node2, node3, node4 ); + assertPath( best14, node1, node2, node3, node4 ); } static EstimateEvaluator ESTIMATE_EVALUATOR = ( node, goal ) -> diff --git a/community/io/src/test/java/org/neo4j/io/pagecache/PageCacheSlowTest.java b/community/io/src/test/java/org/neo4j/io/pagecache/PageCacheSlowTest.java index 7e092e34656c4..efe24253e9267 100644 --- a/community/io/src/test/java/org/neo4j/io/pagecache/PageCacheSlowTest.java +++ b/community/io/src/test/java/org/neo4j/io/pagecache/PageCacheSlowTest.java @@ -101,8 +101,8 @@ public UpdateResult call() throws Exception while ( !shouldStop.get() ) { boolean updateCounter = rng.nextBoolean(); - int pf_flags = updateCounter ? PF_SHARED_WRITE_LOCK : PF_SHARED_READ_LOCK; - performReadOrUpdate( rng, updateCounter, pf_flags ); + int pfFlags = updateCounter ? PF_SHARED_WRITE_LOCK : PF_SHARED_READ_LOCK; + performReadOrUpdate( rng, updateCounter, pfFlags ); } return new UpdateResult( threadId, pageCounts ); @@ -512,10 +512,10 @@ public void pageCacheMustRemainInternallyConsistentWhenGettingRandomFailures() t long maxPageId = pagedFile.getLastPageId(); boolean performingRead = rng.nextBoolean() && maxPageId != -1; long startingPage = maxPageId < 0 ? 0 : rng.nextLong( maxPageId + 1 ); - int pf_flags = performingRead ? PF_SHARED_READ_LOCK : PF_SHARED_WRITE_LOCK; + int pfFlags = performingRead ? PF_SHARED_READ_LOCK : PF_SHARED_WRITE_LOCK; int pageSize = pagedFile.pageSize(); - try ( PageCursor cursor = pagedFile.io( startingPage, pf_flags ) ) + try ( PageCursor cursor = pagedFile.io( startingPage, pfFlags ) ) { if ( performingRead ) { diff --git a/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeCursorTestBase.java b/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeCursorTestBase.java index 43c9ef624483e..ff33104f6112a 100644 --- a/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeCursorTestBase.java +++ b/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeCursorTestBase.java @@ -140,7 +140,7 @@ public void shouldReadLabels() assertTrue( "should access defined node", nodes.next() ); labels = nodes.labels(); assertEquals( "number of labels", 1, labels.numberOfLabels() ); - int _foo = labels.label( 0 ); + int fooLabel = labels.label( 0 ); assertFalse( "should only access a single node", nodes.next() ); // when @@ -150,7 +150,7 @@ public void shouldReadLabels() assertTrue( "should access defined node", nodes.next() ); labels = nodes.labels(); assertEquals( "number of labels", 1, labels.numberOfLabels() ); - int _bar = labels.label( 0 ); + int barLabel = labels.label( 0 ); assertFalse( "should only access a single node", nodes.next() ); // when @@ -160,12 +160,12 @@ public void shouldReadLabels() assertTrue( "should access defined node", nodes.next() ); labels = nodes.labels(); assertEquals( "number of labels", 1, labels.numberOfLabels() ); - int _baz = labels.label( 0 ); + int bazLabel = labels.label( 0 ); assertFalse( "should only access a single node", nodes.next() ); - assertNotEquals( "distinct labels", _foo, _bar ); - assertNotEquals( "distinct labels", _foo, _baz ); - assertNotEquals( "distinct labels", _bar, _baz ); + assertNotEquals( "distinct labels", fooLabel, barLabel ); + assertNotEquals( "distinct labels", fooLabel, bazLabel ); + assertNotEquals( "distinct labels", barLabel, bazLabel ); // when read.singleNode( barbaz, nodes ); @@ -174,14 +174,14 @@ public void shouldReadLabels() assertTrue( "should access defined node", nodes.next() ); labels = nodes.labels(); assertEquals( "number of labels", 2, labels.numberOfLabels() ); - if ( labels.label( 0 ) == _bar ) + if ( labels.label( 0 ) == barLabel ) { - assertEquals( _baz, labels.label( 1 ) ); + assertEquals( bazLabel, labels.label( 1 ) ); } else { - assertEquals( _baz, labels.label( 0 ) ); - assertEquals( _bar, labels.label( 1 ) ); + assertEquals( bazLabel, labels.label( 0 ) ); + assertEquals( barLabel, labels.label( 1 ) ); } assertFalse( "should only access a single node", nodes.next() ); diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java index a74e4c2b9f5c4..2b5c47c3a0d26 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/GeometryType.java @@ -267,13 +267,13 @@ public static long[] encodePoint( int keyId, CoordinateReferenceSystem crs, doub int idBits = StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS; long keyAndType = keyId | (((long) (PropertyType.GEOMETRY.intValue()) << idBits)); - long gtype_bits = GeometryType.GEOMETRY_POINT.gtype << (idBits + 4); - long dimension_bits = ((long) coordinate.length) << (idBits + 8); - long crsTableId_bits = ((long) crs.getTable().getTableId()) << (idBits + 12); - long crsCode_bits = ((long) crs.getCode()) << (idBits + 16); + long gtypeBits = GeometryType.GEOMETRY_POINT.gtype << (idBits + 4); + long dimensionBits = ((long) coordinate.length) << (idBits + 8); + long crsTableIdBits = ((long) crs.getTable().getTableId()) << (idBits + 12); + long crsCodeBits = ((long) crs.getCode()) << (idBits + 16); long[] data = new long[1 + coordinate.length]; - data[0] = keyAndType | gtype_bits | dimension_bits | crsTableId_bits | crsCode_bits; + data[0] = keyAndType | gtypeBits | dimensionBits | crsTableIdBits | crsCodeBits; for ( int i = 0; i < coordinate.length; i++ ) { data[1 + i] = Double.doubleToLongBits( coordinate[i] ); diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/TimeZoneMapping.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/TimeZoneMapping.java index ab9b332a7e080..a2ded19993e15 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/TimeZoneMapping.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/TimeZoneMapping.java @@ -71,7 +71,7 @@ public static Set supportedTimeZones() static { String latestVersion = ""; - Pattern VERSION = Pattern.compile( "# tzdata([0-9]{4}[a-z])" ); + Pattern version = Pattern.compile( "# tzdata([0-9]{4}[a-z])" ); try ( BufferedReader reader = new BufferedReader( new InputStreamReader( TimeZoneMapping.class.getResourceAsStream( "/TZIDS" ) ) ) ) { for ( String line; (line = reader.readLine()) != null; ) @@ -82,7 +82,7 @@ public static Set supportedTimeZones() } else if ( line.startsWith( "#" ) ) { - Matcher matcher = VERSION.matcher( line ); + Matcher matcher = version.matcher( line ); if ( matcher.matches() ) { latestVersion = matcher.group( 1 ); diff --git a/community/kernel/src/test/java/org/neo4j/graphdb/factory/GraphDatabaseSettingsTest.java b/community/kernel/src/test/java/org/neo4j/graphdb/factory/GraphDatabaseSettingsTest.java index 3ec8d888c365a..46bfb1215b404 100644 --- a/community/kernel/src/test/java/org/neo4j/graphdb/factory/GraphDatabaseSettingsTest.java +++ b/community/kernel/src/test/java/org/neo4j/graphdb/factory/GraphDatabaseSettingsTest.java @@ -99,8 +99,8 @@ public void groupToScopeSetting() // when BoltConnector boltConnector = new BoltConnector( scoping ); - Setting advertised_address = boltConnector.advertised_address; - AdvertisedSocketAddress advertisedSocketAddress = advertised_address.apply( config::get ); + Setting advertisedAddress = boltConnector.advertised_address; + AdvertisedSocketAddress advertisedSocketAddress = advertisedAddress.apply( config::get ); // then assertEquals( hostname, advertisedSocketAddress.getHostname() ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/api/index/ArrayEncoderTest.java b/community/kernel/src/test/java/org/neo4j/kernel/api/index/ArrayEncoderTest.java index 91d6ee4cc0708..7e292165e0fd1 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/api/index/ArrayEncoderTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/api/index/ArrayEncoderTest.java @@ -134,7 +134,7 @@ public void shouldEncodeArrays() public void shouldEncodeProperlyWithMultipleThreadsRacing() throws Throwable { // given - String[] INPUT = { + final String[] INPUT = { "These strings need to be longer than 57 bytes, because that is the line wrapping length of BASE64.", "This next line is also long. The number of strings in this array is the number of threads to use.", "Each thread will get a different string as input to encode, and ensure the result is always the same.", diff --git a/community/kernel/src/test/java/org/neo4j/kernel/api/index/CompositeIndexAccessorCompatibility.java b/community/kernel/src/test/java/org/neo4j/kernel/api/index/CompositeIndexAccessorCompatibility.java index e89af146b6b56..904b2a3bb4ad4 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/api/index/CompositeIndexAccessorCompatibility.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/api/index/CompositeIndexAccessorCompatibility.java @@ -82,24 +82,24 @@ public void testIndexSeekAndScanByPoint() throws Exception { PointValue gps = Values.pointValue( CoordinateReferenceSystem.WGS84, 12.6, 56.7 ); PointValue car = Values.pointValue( CoordinateReferenceSystem.Cartesian, 12.6, 56.7 ); - PointValue gps_3d = Values.pointValue( CoordinateReferenceSystem.WGS84_3D, 12.6, 56.7, 100.0 ); - PointValue car_3d = Values.pointValue( CoordinateReferenceSystem.Cartesian_3D, 12.6, 56.7, 100.0 ); + PointValue gps3d = Values.pointValue( CoordinateReferenceSystem.WGS84_3D, 12.6, 56.7, 100.0 ); + PointValue car3d = Values.pointValue( CoordinateReferenceSystem.Cartesian_3D, 12.6, 56.7, 100.0 ); updateAndCommit( asList( add( 1L, descriptor.schema(), gps, gps ), add( 2L, descriptor.schema(), car, car ), add( 3L, descriptor.schema(), gps, car ), - add( 4L, descriptor.schema(), gps_3d, gps_3d ), - add( 5L, descriptor.schema(), car_3d, car_3d ), - add( 6L, descriptor.schema(), gps, car_3d ) + add( 4L, descriptor.schema(), gps3d, gps3d ), + add( 5L, descriptor.schema(), car3d, car3d ), + add( 6L, descriptor.schema(), gps, car3d ) ) ); assertThat( query( exact( 0, gps ), exact( 1, gps ) ), equalTo( singletonList( 1L ) ) ); assertThat( query( exact( 0, car ), exact( 1, car ) ), equalTo( singletonList( 2L ) ) ); assertThat( query( exact( 0, gps ), exact( 1, car ) ), equalTo( singletonList( 3L ) ) ); - assertThat( query( exact( 0, gps_3d ), exact( 1, gps_3d ) ), equalTo( singletonList( 4L ) ) ); - assertThat( query( exact( 0, car_3d ), exact( 1, car_3d ) ), equalTo( singletonList( 5L ) ) ); - assertThat( query( exact( 0, gps ), exact( 1, car_3d ) ), equalTo( singletonList( 6L ) ) ); + assertThat( query( exact( 0, gps3d ), exact( 1, gps3d ) ), equalTo( singletonList( 4L ) ) ); + assertThat( query( exact( 0, car3d ), exact( 1, car3d ) ), equalTo( singletonList( 5L ) ) ); + assertThat( query( exact( 0, gps ), exact( 1, car3d ) ), equalTo( singletonList( 6L ) ) ); assertThat( query( exists( 1 ) ), equalTo( asList( 1L, 2L, 3L, 4L, 5L, 6L ) ) ); } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateCompositeIndexTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateCompositeIndexTest.java index 43c5b15436934..927772b1cea97 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateCompositeIndexTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateCompositeIndexTest.java @@ -155,12 +155,12 @@ public void shouldSeekWhenThereAreManyEntriesWithTheSameValues() public void shouldSeekInComplexMix() { // GIVEN - ValueTuple[] values2_1 = Iterators.array( + ValueTuple[] values21 = Iterators.array( ValueTuple.of( "hi", 3 ), ValueTuple.of( 9L, 33L ), ValueTuple.of( "sneaker", false ) ); - ValueTuple[] values2_2 = Iterators.array( + ValueTuple[] values22 = Iterators.array( ValueTuple.of( true, false ), ValueTuple.of( new int[]{ 10,100}, "array-buddy" ), ValueTuple.of( 40.1, 40.2 ) ); @@ -170,12 +170,12 @@ public void shouldSeekInComplexMix() ValueTuple.of( true, new long[]{4L}, 33L ), ValueTuple.of( 2, false, 1 ) ); - addEntries( indexOn_1_1_2, values2_1, 10 ); - addEntries( indexOn_2_2_3, values2_2, 100 ); + addEntries( indexOn_1_1_2, values21, 10 ); + addEntries( indexOn_2_2_3, values22, 100 ); addEntries( indexOn_2_2_3_4, values3, 1000 ); - assertSeek( indexOn_1_1_2, values2_1, 10 ); - assertSeek( indexOn_2_2_3, values2_2, 100 ); + assertSeek( indexOn_1_1_2, values21, 10 ); + assertSeek( indexOn_2_2_3, values22, 100 ); assertSeek( indexOn_2_2_3_4, values3, 1000 ); } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/core/TestRelationship.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/core/TestRelationship.java index 63c21aeea17f1..b211409a62ada 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/core/TestRelationship.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/core/TestRelationship.java @@ -772,9 +772,9 @@ public void makeSureLazyLoadingRelationshipsWorksEvenIfOtherIteratorAlsoLoadsInT /* create 256 nodes */ GraphDatabaseService graphDB = getGraphDb(); Node[] nodes = new Node[256]; - for ( int num_nodes = 0; num_nodes < nodes.length; num_nodes += 1 ) + for ( int numNodes = 0; numNodes < nodes.length; numNodes += 1 ) { - nodes[num_nodes] = graphDB.createNode(); + nodes[numNodes] = graphDB.createNode(); } newTransaction(); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/ArrayQueueOutOfOrderSequenceTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/ArrayQueueOutOfOrderSequenceTest.java index 5f6c6621dd8a1..98fa335083637 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/ArrayQueueOutOfOrderSequenceTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/ArrayQueueOutOfOrderSequenceTest.java @@ -191,14 +191,14 @@ public void highestEverSeenTest() public void shouldBeAbleToTimeoutWaitingForNumber() throws Exception { // given - long TIMEOUT = 10; + long timeout = 10; final OutOfOrderSequence sequence = new ArrayQueueOutOfOrderSequence( 3, 5, EMPTY_META ); long startTime = System.currentTimeMillis(); try { // when - sequence.await( 4, TIMEOUT ); + sequence.await( 4, timeout ); fail(); } catch ( TimeoutException e ) @@ -207,7 +207,7 @@ public void shouldBeAbleToTimeoutWaitingForNumber() throws Exception } long endTime = System.currentTimeMillis(); - assertThat( endTime - startTime, greaterThanOrEqualTo( TIMEOUT ) ); + assertThat( endTime - startTime, greaterThanOrEqualTo( timeout ) ); } @Test diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestGrowingFileMemoryMapping.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestGrowingFileMemoryMapping.java index b41aaf389dd22..2c4cd7e9662e8 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestGrowingFileMemoryMapping.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestGrowingFileMemoryMapping.java @@ -63,7 +63,7 @@ public void shouldGrowAFileWhileContinuingToMemoryMapNewRegions() assumeTrue( !SystemUtils.IS_OS_WINDOWS ); // given - int NUMBER_OF_RECORDS = 1000000; + final int NUMBER_OF_RECORDS = 1000000; File storeDir = testDirectory.graphDbDir(); Config config = Config.defaults( pagecache_memory, mmapSize( NUMBER_OF_RECORDS, NodeRecordFormat.RECORD_SIZE ) ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/kvstore/BigEndianByteArrayBufferTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/kvstore/BigEndianByteArrayBufferTest.java index 849a065a9aecc..769b11c59f42d 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/kvstore/BigEndianByteArrayBufferTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/kvstore/BigEndianByteArrayBufferTest.java @@ -115,9 +115,9 @@ public void shouldWriteByte() public void shouldCompareByteArrays() { // given - Matcher LESS_THAN = lessThan( 0 ); - Matcher GREATER_THAN = greaterThan( 0 ); - Matcher EQUAL_TO = equalTo( 0 ); + final Matcher LESS_THAN = lessThan( 0 ); + final Matcher GREATER_THAN = greaterThan( 0 ); + final Matcher EQUAL_TO = equalTo( 0 ); // then assertCompare( new byte[0], EQUAL_TO, new byte[0] ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipGroupGetterTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipGroupGetterTest.java index da51e57bb25d9..51be71acbdba7 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipGroupGetterTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipGroupGetterTest.java @@ -72,17 +72,17 @@ public void shouldAbortLoadingGroupChainIfComeTooFar() { RecordStore store = spy( stores.getRelationshipGroupStore() ); - RelationshipGroupRecord group_2 = group( 0, 2 ); - RelationshipGroupRecord group_4 = group( 1, 4 ); - RelationshipGroupRecord group_10 = group( 2, 10 ); - RelationshipGroupRecord group_23 = group( 3, 23 ); - link( group_2, group_4, group_10, group_23 ); - store.updateRecord( group_2 ); - store.updateRecord( group_4 ); - store.updateRecord( group_10 ); - store.updateRecord( group_23 ); + RelationshipGroupRecord group2 = group( 0, 2 ); + RelationshipGroupRecord group4 = group( 1, 4 ); + RelationshipGroupRecord group10 = group( 2, 10 ); + RelationshipGroupRecord group23 = group( 3, 23 ); + link( group2, group4, group10, group23 ); + store.updateRecord( group2 ); + store.updateRecord( group4 ); + store.updateRecord( group10 ); + store.updateRecord( group23 ); RelationshipGroupGetter groupGetter = new RelationshipGroupGetter( store ); - NodeRecord node = new NodeRecord( 0, true, group_2.getId(), -1 ); + NodeRecord node = new NodeRecord( 0, true, group2.getId(), -1 ); // WHEN trying to find relationship group 7 RecordAccess access = @@ -91,16 +91,16 @@ public void shouldAbortLoadingGroupChainIfComeTooFar() // THEN only groups 2, 4 and 10 should have been loaded InOrder verification = inOrder( store ); - verification.verify( store ).getRecord( eq( group_2.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); - verification.verify( store ).getRecord( eq( group_4.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); - verification.verify( store ).getRecord( eq( group_10.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); + verification.verify( store ).getRecord( eq( group2.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); + verification.verify( store ).getRecord( eq( group4.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); + verification.verify( store ).getRecord( eq( group10.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); verification.verify( store, times( 0 ) ) - .getRecord( eq( group_23.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); + .getRecord( eq( group23.getId() ), any( RelationshipGroupRecord.class ), any( RecordLoad.class ) ); // it should also be reported as not found assertNull( result.group() ); // with group 4 as closes previous one - assertEquals( group_4, result.closestPrevious().forReadingData() ); + assertEquals( group4, result.closestPrevious().forReadingData() ); } } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java index a9fece90dcdb7..b70807f9e6a44 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java @@ -39,7 +39,6 @@ import org.neo4j.helpers.collection.Iterables; import org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor; import org.neo4j.kernel.api.exceptions.TransactionFailureException; -import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; import org.neo4j.kernel.api.index.IndexEntryUpdate; import org.neo4j.kernel.impl.api.BatchTransactionApplier; import org.neo4j.kernel.impl.api.CommandVisitor; @@ -608,30 +607,30 @@ public void shouldIgnoreRelationshipGroupCommandsForGroupThatIsCreatedAndDeleted */ // Given: // - dense node threshold of 5 - // - node with 4 rels of type A and 1 rel of type B + // - node with 4 rels of type relationshipB and 1 rel of type relationshipB NeoStores neoStore = neoStoresRule.builder() .with( GraphDatabaseSettings.dense_node_threshold.name(), "5" ).build(); - int A = 0; - int B = 1; + int relationshipA = 0; + int relationshipB = 1; TransactionRecordState state = newTransactionRecordState( neoStore ); state.nodeCreate( 0 ); - state.relCreate( 0, A, 0, 0 ); - state.relCreate( 1, A, 0, 0 ); - state.relCreate( 2, A, 0, 0 ); - state.relCreate( 3, A, 0, 0 ); - state.relCreate( 4, B, 0, 0 ); + state.relCreate( 0, relationshipA, 0, 0 ); + state.relCreate( 1, relationshipA, 0, 0 ); + state.relCreate( 2, relationshipA, 0, 0 ); + state.relCreate( 3, relationshipA, 0, 0 ); + state.relCreate( 4, relationshipB, 0, 0 ); apply( neoStore, state ); - // When doing a tx where a relationship of type A for the node is create and rel of type B is deleted + // When doing a tx where a relationship of type A for the node is create and rel of type relationshipB is deleted state = newTransactionRecordState( neoStore ); - state.relCreate( 5, A, 0, 0 ); // here this node should be converted to dense and the groups should be created - state.relDelete( 4 ); // here the group B should be delete + state.relCreate( 5, relationshipA, 0, 0 ); // here this node should be converted to dense and the groups should be created + state.relDelete( 4 ); // here the group relationshipB should be delete // Then Collection commands = new ArrayList<>(); state.extractCommands( commands ); RelationshipGroupCommand group = singleRelationshipGroupCommand( commands ); - assertEquals( A, group.getAfter().getType() ); + assertEquals( relationshipA, group.getAfter().getType() ); } @Test diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/traversal/TestMultipleStartNodes.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/traversal/TestMultipleStartNodes.java index 6efbed547ecb1..94a7597c78625 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/traversal/TestMultipleStartNodes.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/traversal/TestMultipleStartNodes.java @@ -50,17 +50,17 @@ public void myFriendsAsWellAsYourFriends() try ( Transaction tx = beginTx() ) { - RelationshipType KNOW = withName( "KNOW" ); + RelationshipType knowRelType = withName( "KNOW" ); Node you = getNodeWithName( "you" ); Node me = getNodeWithName( "me" ); String[] levelOneFriends = new String[]{"f1", "f2", "f3", "f4", "f7"}; - TraversalDescription levelOneTraversal = getGraphDb().traversalDescription().relationships( KNOW ).evaluator( atDepth( 1 ) ); + TraversalDescription levelOneTraversal = getGraphDb().traversalDescription().relationships( knowRelType ).evaluator( atDepth( 1 ) ); expectNodes( levelOneTraversal.depthFirst().traverse( you, me ), levelOneFriends ); expectNodes( levelOneTraversal.breadthFirst().traverse( you, me ), levelOneFriends ); String[] levelTwoFriends = new String[]{"f5", "f6", "f8"}; - TraversalDescription levelTwoTraversal = getGraphDb().traversalDescription().relationships( KNOW ).evaluator( atDepth( 2 ) ); + TraversalDescription levelTwoTraversal = getGraphDb().traversalDescription().relationships( knowRelType ).evaluator( atDepth( 2 ) ); expectNodes( levelTwoTraversal.depthFirst().traverse( you, me ), levelTwoFriends ); expectNodes( levelTwoTraversal.breadthFirst().traverse( you, me ), levelTwoFriends ); } diff --git a/community/lucene-index/src/test/java/examples/RelatedNodesQuestionTest.java b/community/lucene-index/src/test/java/examples/RelatedNodesQuestionTest.java index bb4b2a7e6dccc..e72cc98dbe0fc 100644 --- a/community/lucene-index/src/test/java/examples/RelatedNodesQuestionTest.java +++ b/community/lucene-index/src/test/java/examples/RelatedNodesQuestionTest.java @@ -49,11 +49,11 @@ public void question5346011() // ...creation of the nodes and relationship Node node1 = service.createNode(); Node node2 = service.createNode(); - String a_uuid = "xyz"; + String uuid = "xyz"; Relationship relationship = node1.createRelationshipTo( node2, RelationshipType.withName( "related" ) ); - index.add( relationship, "uuid", a_uuid ); + index.add( relationship, "uuid", uuid ); // query - try ( IndexHits hits = index.get( "uuid", a_uuid, node1, node2 ) ) + try ( IndexHits hits = index.get( "uuid", uuid, node1, node2 ) ) { assertEquals( 1, hits.size() ); } diff --git a/community/lucene-index/src/test/java/org/neo4j/index/impl/lucene/explicit/TestLuceneIndex.java b/community/lucene-index/src/test/java/org/neo4j/index/impl/lucene/explicit/TestLuceneIndex.java index 39b9e38fa1f6c..28925db9545f7 100644 --- a/community/lucene-index/src/test/java/org/neo4j/index/impl/lucene/explicit/TestLuceneIndex.java +++ b/community/lucene-index/src/test/java/org/neo4j/index/impl/lucene/explicit/TestLuceneIndex.java @@ -1662,9 +1662,9 @@ public void canQueryWithWildcardEvenIfAlternativeRemovalMethodsUsedInSameTx2() @Test public void updateIndex() { - String TEXT = "text"; - String NUMERIC = "numeric"; - String TEXT_1 = "text_1"; + final String TEXT = "text"; + final String NUMERIC = "numeric"; + final String TEXT_1 = "text_1"; Index index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG ); Node n = graphDb.createNode(); diff --git a/community/neo4j/src/test/java/org/neo4j/metatest/TestGraphDescription.java b/community/neo4j/src/test/java/org/neo4j/metatest/TestGraphDescription.java index 1657adb49a9b1..3340221408f50 100644 --- a/community/neo4j/src/test/java/org/neo4j/metatest/TestGraphDescription.java +++ b/community/neo4j/src/test/java/org/neo4j/metatest/TestGraphDescription.java @@ -182,29 +182,29 @@ private void verifyIKnowYou( String type, String myName ) { Map graph = data.get(); assertEquals( "Wrong graph size.", 2, graph.size() ); - Node I = graph.get( "I" ); - assertNotNull( "The node 'I' was not defined", I ); + Node iNode = graph.get( "I" ); + assertNotNull( "The node 'I' was not defined", iNode ); Node you = graph.get( "you" ); assertNotNull( "The node 'you' was not defined", you ); - assertEquals( "'I' has wrong 'name'.", myName, I.getProperty( "name" ) ); + assertEquals( "'I' has wrong 'name'.", myName, iNode.getProperty( "name" ) ); assertEquals( "'you' has wrong 'name'.", "you", you.getProperty( "name" ) ); - Iterator rels = I.getRelationships().iterator(); + Iterator rels = iNode.getRelationships().iterator(); assertTrue( "'I' has too few relationships", rels.hasNext() ); Relationship rel = rels.next(); - assertEquals( "'I' is not related to 'you'", you, rel.getOtherNode( I ) ); + assertEquals( "'I' is not related to 'you'", you, rel.getOtherNode( iNode ) ); assertEquals( "Wrong relationship type.", type, rel.getType().name() ); assertFalse( "'I' has too many relationships", rels.hasNext() ); rels = you.getRelationships().iterator(); assertTrue( "'you' has too few relationships", rels.hasNext() ); rel = rels.next(); - assertEquals( "'you' is not related to 'i'", I, rel.getOtherNode( you ) ); + assertEquals( "'you' is not related to 'i'", iNode, rel.getOtherNode( you ) ); assertEquals( "Wrong relationship type.", type, rel.getType().name() ); assertFalse( "'you' has too many relationships", rels.hasNext() ); - assertEquals( "wrong direction", I, rel.getStartNode() ); + assertEquals( "wrong direction", iNode, rel.getStartNode() ); } } diff --git a/community/neo4j/src/test/java/recovery/UniquenessRecoveryTest.java b/community/neo4j/src/test/java/recovery/UniquenessRecoveryTest.java index ea608a04c3cfd..2bb216acc69e6 100644 --- a/community/neo4j/src/test/java/recovery/UniquenessRecoveryTest.java +++ b/community/neo4j/src/test/java/recovery/UniquenessRecoveryTest.java @@ -49,12 +49,10 @@ import org.neo4j.test.rule.SuppressOutput; import org.neo4j.test.rule.TestDirectory; +import static java.lang.Boolean.getBoolean; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeNotNull; - -import static java.lang.Boolean.getBoolean; - import static org.neo4j.graphdb.Label.label; import static org.neo4j.test.rule.SuppressOutput.suppress; @@ -320,12 +318,12 @@ public static List configurations() ArrayList configurations = new ArrayList<>(); if ( EXHAUSTIVE ) { - for ( int kill_signal : KILL_SIGNALS ) + for ( int killSignal : KILL_SIGNALS ) { configurations - .add( new Configuration().force_create_constraint( true ).kill_signal( kill_signal ).build() ); + .add( new Configuration().force_create_constraint( true ).kill_signal( killSignal ).build() ); configurations - .add( new Configuration().force_create_constraint( false ).kill_signal( kill_signal ).build() ); + .add( new Configuration().force_create_constraint( false ).kill_signal( killSignal ).build() ); } } else diff --git a/community/security/src/test/java/org/neo4j/server/security/auth/UserTest.java b/community/security/src/test/java/org/neo4j/server/security/auth/UserTest.java index 8994e668fee61..9e49b3a493c02 100644 --- a/community/security/src/test/java/org/neo4j/server/security/auth/UserTest.java +++ b/community/security/src/test/java/org/neo4j/server/security/auth/UserTest.java @@ -42,17 +42,17 @@ public void shouldBuildImmutableUser() assertThat( u1, equalTo( u1 ) ); assertThat( u1, not( equalTo( u2 ) ) ); - User u1_as_u2 = u1.augment().withCredentials( fruit ) + User u1AsU2 = u1.augment().withCredentials( fruit ) .withRequiredPasswordChange( true ) .withFlag( "nice_guy" ).build(); - assertThat( u1, not( equalTo( u1_as_u2 ))); - assertThat( u2, equalTo( u1_as_u2 )); + assertThat( u1, not( equalTo( u1AsU2 ))); + assertThat( u2, equalTo( u1AsU2 )); - User u2_as_u1 = u2.augment().withCredentials( abc ) + User u2AsU1 = u2.augment().withCredentials( abc ) .withRequiredPasswordChange( false ) .withoutFlag( "nice_guy" ).build(); - assertThat( u2, not( equalTo( u2_as_u1 ))); - assertThat( u1, equalTo( u2_as_u1 )); + assertThat( u2, not( equalTo( u2AsU1 ))); + assertThat( u1, equalTo( u2AsU1 )); assertThat( u1, not( equalTo( u2 ) ) ); } diff --git a/community/server/src/test/java/org/neo4j/server/rest/transactional/ExecutionResultSerializerTest.java b/community/server/src/test/java/org/neo4j/server/rest/transactional/ExecutionResultSerializerTest.java index 6fb83642147ac..47372eb88514f 100644 --- a/community/server/src/test/java/org/neo4j/server/rest/transactional/ExecutionResultSerializerTest.java +++ b/community/server/src/test/java/org/neo4j/server/rest/transactional/ExecutionResultSerializerTest.java @@ -26,7 +26,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.io.UnsupportedEncodingException; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; @@ -570,14 +569,14 @@ public void shouldProduceResultStreamWithGraphEntries() throws Exception int n3 = result.indexOf( node3 ); int r0 = result.indexOf( rel0 ); int r1 = result.indexOf( rel1 ); - int _0 = result.indexOf( row0 ); - int _1 = result.indexOf( row1 ); - assertTrue( "result should contain row0", _0 > 0 ); - assertTrue( "result should contain row1 after row0", _1 > _0 ); - assertTrue( "result should contain node0 after row0", n0 > _0 ); - assertTrue( "result should contain node1 after row0", n1 > _0 ); - assertTrue( "result should contain node2 after row1", n2 > _1 ); - assertTrue( "result should contain node3 after row1", n3 > _1 ); + int row0Index = result.indexOf( row0 ); + int row1Index = result.indexOf( row1 ); + assertTrue( "result should contain row0", row0Index > 0 ); + assertTrue( "result should contain row1 after row0", row1Index > row0Index ); + assertTrue( "result should contain node0 after row0", n0 > row0Index ); + assertTrue( "result should contain node1 after row0", n1 > row0Index ); + assertTrue( "result should contain node2 after row1", n2 > row1Index ); + assertTrue( "result should contain node3 after row1", n3 > row1Index ); assertTrue( "result should contain rel0 after node0 and node1", r0 > n0 && r0 > n1 ); assertTrue( "result should contain rel1 after node2 and node3", r1 > n2 && r1 > n3 ); } diff --git a/community/server/src/test/java/org/neo4j/server/rest/web/DatabaseActionsTest.java b/community/server/src/test/java/org/neo4j/server/rest/web/DatabaseActionsTest.java index 4c2e75c2878fc..3d4be38ca63a9 100644 --- a/community/server/src/test/java/org/neo4j/server/rest/web/DatabaseActionsTest.java +++ b/community/server/src/test/java/org/neo4j/server/rest/web/DatabaseActionsTest.java @@ -26,7 +26,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -774,16 +773,16 @@ private long createBasicTraversableGraph() // (Emil) (Peter) (Tobias) long startNode = graphdbHelper.createNode( MapUtil.map( "name", "Root" ), LABEL ); - long child1_l1 = graphdbHelper.createNode( MapUtil.map( "name", "Mattias" ), LABEL ); - graphdbHelper.createRelationship( "knows", startNode, child1_l1 ); - long child2_l1 = graphdbHelper.createNode( MapUtil.map( "name", "Johan" ), LABEL ); - graphdbHelper.createRelationship( "knows", startNode, child2_l1 ); - long child1_l2 = graphdbHelper.createNode( MapUtil.map( "name", "Emil" ), LABEL ); - graphdbHelper.createRelationship( "knows", child2_l1, child1_l2 ); - long child1_l3 = graphdbHelper.createNode( MapUtil.map( "name", "Peter" ), LABEL ); - graphdbHelper.createRelationship( "knows", child1_l2, child1_l3 ); - long child2_l3 = graphdbHelper.createNode( MapUtil.map( "name", "Tobias" ), LABEL ); - graphdbHelper.createRelationship( "loves", child1_l2, child2_l3 ); + long child1L1 = graphdbHelper.createNode( MapUtil.map( "name", "Mattias" ), LABEL ); + graphdbHelper.createRelationship( "knows", startNode, child1L1 ); + long child2L1 = graphdbHelper.createNode( MapUtil.map( "name", "Johan" ), LABEL ); + graphdbHelper.createRelationship( "knows", startNode, child2L1 ); + long child1L2 = graphdbHelper.createNode( MapUtil.map( "name", "Emil" ), LABEL ); + graphdbHelper.createRelationship( "knows", child2L1, child1L2 ); + long child1L3 = graphdbHelper.createNode( MapUtil.map( "name", "Peter" ), LABEL ); + graphdbHelper.createRelationship( "knows", child1L2, child1L3 ); + long child2L3 = graphdbHelper.createNode( MapUtil.map( "name", "Tobias" ), LABEL ); + graphdbHelper.createRelationship( "loves", child1L2, child2L3 ); return startNode; } diff --git a/community/server/src/test/java/org/neo4j/server/rest/web/RestfulGraphDatabaseTest.java b/community/server/src/test/java/org/neo4j/server/rest/web/RestfulGraphDatabaseTest.java index 766a69fd858fa..68a8281070bf1 100644 --- a/community/server/src/test/java/org/neo4j/server/rest/web/RestfulGraphDatabaseTest.java +++ b/community/server/src/test/java/org/neo4j/server/rest/web/RestfulGraphDatabaseTest.java @@ -24,7 +24,6 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.io.IOException; import java.net.URI; import java.util.Collection; import java.util.Collections; @@ -55,7 +54,6 @@ import org.neo4j.server.rest.domain.JsonParseException; import org.neo4j.server.rest.domain.TraverserReturnType; import org.neo4j.server.rest.paging.LeaseManager; -import org.neo4j.server.rest.repr.BadInputException; import org.neo4j.server.rest.repr.RelationshipRepresentationTest; import org.neo4j.server.rest.repr.formats.JsonFormat; import org.neo4j.server.rest.web.DatabaseActions.RelationshipDirection; @@ -1742,17 +1740,17 @@ public void shouldGet200WhenNoHitsReturnedFromTraverse() public void shouldGetSomeHitsWhenTraversingWithDefaultDescription() { long startNode = helper.createNode(); - long child1_l1 = helper.createNode(); - helper.createRelationship( "knows", startNode, child1_l1 ); - long child2_l1 = helper.createNode(); - helper.createRelationship( "knows", startNode, child2_l1 ); - long child1_l2 = helper.createNode(); - helper.createRelationship( "knows", child2_l1, child1_l2 ); + long child1L1 = helper.createNode(); + helper.createRelationship( "knows", startNode, child1L1 ); + long child2L1 = helper.createNode(); + helper.createRelationship( "knows", startNode, child2L1 ); + long child1L2 = helper.createNode(); + helper.createRelationship( "knows", child2L1, child1L2 ); Response response = service.traverse( startNode, TraverserReturnType.node, "" ); String entity = entityAsString( response ); - assertTrue( entity.contains( "/node/" + child1_l1 ) ); - assertTrue( entity.contains( "/node/" + child2_l1 ) ); - assertFalse( entity.contains( "/node/" + child1_l2 ) ); + assertTrue( entity.contains( "/node/" + child1L1 ) ); + assertTrue( entity.contains( "/node/" + child2L1 ) ); + assertFalse( entity.contains( "/node/" + child1L2 ) ); checkContentTypeCharsetUtf8(response); } diff --git a/community/spatial-index/src/main/java/org/neo4j/gis/spatial/index/Envelope.java b/community/spatial-index/src/main/java/org/neo4j/gis/spatial/index/Envelope.java index 3e7151afd8a7b..7c019e3b18853 100644 --- a/community/spatial-index/src/main/java/org/neo4j/gis/spatial/index/Envelope.java +++ b/community/spatial-index/src/main/java/org/neo4j/gis/spatial/index/Envelope.java @@ -323,24 +323,24 @@ public Envelope intersection( Envelope other ) { if ( getDimension() == other.getDimension() ) { - double[] i_min = new double[this.min.length]; - double[] i_max = new double[this.min.length]; - Arrays.fill(i_min, Double.NaN); - Arrays.fill(i_max, Double.NaN); + double[] iMin = new double[this.min.length]; + double[] iMax = new double[this.min.length]; + Arrays.fill(iMin, Double.NaN); + Arrays.fill(iMax, Double.NaN); boolean result = true; for ( int i = 0; i < min.length; i++ ) { if ( other.min[i] <= this.max[i] && other.max[i] >= this.min[i] ) { - i_min[i] = Math.max(this.min[i], other.min[i]); - i_max[i] = Math.min(this.max[i], other.max[i]); + iMin[i] = Math.max(this.min[i], other.min[i]); + iMax[i] = Math.min(this.max[i], other.max[i]); } else { result = false; } } - return result ? new Envelope( i_min, i_max ) : null; + return result ? new Envelope( iMin, iMax ) : null; } else { diff --git a/community/spatial-index/src/test/java/org/neo4j/gis/spatial/index/EnvelopeTest.java b/community/spatial-index/src/test/java/org/neo4j/gis/spatial/index/EnvelopeTest.java index d3e39906d6f90..e3af266646b52 100644 --- a/community/spatial-index/src/test/java/org/neo4j/gis/spatial/index/EnvelopeTest.java +++ b/community/spatial-index/src/test/java/org/neo4j/gis/spatial/index/EnvelopeTest.java @@ -48,21 +48,21 @@ public void shouldCreateBasic2DEnvelopes() @Test public void shouldHandleIntersectionsIn1D() { - double width_x = 1.0; - double width_y = 1.0; - Envelope left = new Envelope( 0.0, width_x, 0.0, width_y ); + double widthX = 1.0; + double widthY = 1.0; + Envelope left = new Envelope( 0.0, widthX, 0.0, widthY ); for ( double minx = -10.0; minx < 10.0; minx += 0.2 ) { - double maxx = minx + width_x; - Envelope right = new Envelope( minx, maxx, 0.0, width_y ); + double maxx = minx + widthX; + Envelope right = new Envelope( minx, maxx, 0.0, widthY ); if ( maxx < left.getMinX() || minx > left.getMaxX() ) { testDoesNotOverlap(left, right); } else { - double overlap_x = (maxx < left.getMaxX()) ? maxx - left.getMinX() : left.getMaxX() - minx; - double overlap = overlap_x * width_y; + double overlapX = (maxx < left.getMaxX()) ? maxx - left.getMinX() : left.getMaxX() - minx; + double overlap = overlapX * widthY; testOverlaps(left, right, true, overlap); } } diff --git a/community/values/src/main/java/org/neo4j/values/storable/CRSCalculator.java b/community/values/src/main/java/org/neo4j/values/storable/CRSCalculator.java index aa390d1c24e29..5f66fa583ff0f 100644 --- a/community/values/src/main/java/org/neo4j/values/storable/CRSCalculator.java +++ b/community/values/src/main/java/org/neo4j/values/storable/CRSCalculator.java @@ -137,42 +137,42 @@ public Pair boundingBox( PointValue center, double distan // Extend the distance slightly to assure that all relevant points lies inside the bounding box, // with rounding errors taken into account - double extended_distance = distance * EXTENSION_FACTOR; + double extendedDistance = distance * EXTENSION_FACTOR; CoordinateReferenceSystem crs = center.getCoordinateReferenceSystem(); double lat = center.coordinate()[1]; double lon = center.coordinate()[0]; - double r = extended_distance / EARTH_RADIUS_METERS; + double r = extendedDistance / EARTH_RADIUS_METERS; - double lat_min = lat - toDegrees( r ); - double lat_max = lat + toDegrees( r ); + double latMin = lat - toDegrees( r ); + double latMax = lat + toDegrees( r ); // If your query circle includes one of the poles - if ( lat_max >= 90 ) + if ( latMax >= 90 ) { - return boundingBoxOf( -180, 180, lat_min, 90, center, distance ); + return boundingBoxOf( -180, 180, latMin, 90, center, distance ); } - else if ( lat_min <= -90 ) + else if ( latMin <= -90 ) { - return boundingBoxOf( -180, 180, -90, lat_max, center, distance ); + return boundingBoxOf( -180, 180, -90, latMax, center, distance ); } else { - double delta_lon = toDegrees( asin( sin( r ) / cos( toRadians( lat ) ) ) ); - double lon_min = lon - delta_lon; - double lon_max = lon + delta_lon; + double deltaLon = toDegrees( asin( sin( r ) / cos( toRadians( lat ) ) ) ); + double lonMin = lon - deltaLon; + double lonMax = lon + deltaLon; // If you query circle wraps around the dateline // Large rectangle covering all longitudes // TODO implement two rectangle solution instead - if ( lon_min < -180 || lon_max > 180 ) + if ( lonMin < -180 || lonMax > 180 ) { - return boundingBoxOf( -180, 180, lat_min, lat_max, center, distance ); + return boundingBoxOf( -180, 180, latMin, latMax, center, distance ); } else { - return boundingBoxOf( lon_min, lon_max, lat_min, lat_max, center, distance ); + return boundingBoxOf( lonMin, lonMax, latMin, latMax, center, distance ); } } } diff --git a/community/values/src/test/java/org/neo4j/values/storable/CoordinateReferenceSystemTest.java b/community/values/src/test/java/org/neo4j/values/storable/CoordinateReferenceSystemTest.java index 42dc1cb231390..759b3ac3377d4 100644 --- a/community/values/src/test/java/org/neo4j/values/storable/CoordinateReferenceSystemTest.java +++ b/community/values/src/test/java/org/neo4j/values/storable/CoordinateReferenceSystemTest.java @@ -112,14 +112,14 @@ public void shouldCalculateGeographicDistance3D() CoordinateReferenceSystem crs = CoordinateReferenceSystem.WGS84_3D; //"distance function should measure distance from Copenhagen train station to Neo4j in Malmö" PointValue cph = geo( 12.564590, 55.672874, 0.0 ); - PointValue cph_high = geo( 12.564590, 55.672874, 1000.0 ); + PointValue cphHigh = geo( 12.564590, 55.672874, 1000.0 ); PointValue malmo = geo( 12.994341, 55.611784, 0.0 ); - PointValue malmo_high = geo( 12.994341, 55.611784, 1000.0 ); + PointValue malmoHigh = geo( 12.994341, 55.611784, 1000.0 ); double expected = 27842.0; - double expected_high = 27860.0; + double expectedHigh = 27860.0; assertThat( "3D distance should match", crs.getCalculator().distance( cph, malmo ), closeTo( expected, 0.1 ) ); - assertThat( "3D distance should match", crs.getCalculator().distance( cph, malmo_high ), closeTo( expected_high, 0.2 ) ); - assertThat( "3D distance should match", crs.getCalculator().distance( cph_high, malmo ), closeTo( expected_high, 0.2 ) ); + assertThat( "3D distance should match", crs.getCalculator().distance( cph, malmoHigh ), closeTo( expectedHigh, 0.2 ) ); + assertThat( "3D distance should match", crs.getCalculator().distance( cphHigh, malmo ), closeTo( expectedHigh, 0.2 ) ); } private PointValue cart( double... coords ) diff --git a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/core/consensus/roles/LeaderTest.java b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/core/consensus/roles/LeaderTest.java index 598fdd2a645c7..7afc3f82172c0 100644 --- a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/core/consensus/roles/LeaderTest.java +++ b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/core/consensus/roles/LeaderTest.java @@ -540,7 +540,7 @@ public void leaderShouldHandleBatch() throws Exception Leader leader = new Leader(); - int BATCH_SIZE = 3; + final int BATCH_SIZE = 3; RaftMessages.NewEntry.BatchRequest batchRequest = new RaftMessages.NewEntry.BatchRequest( BATCH_SIZE ); batchRequest.add( valueOf( 0 ) ); batchRequest.add( valueOf( 1 ) ); diff --git a/enterprise/fulltext-addon/src/test/java/org/neo4j/kernel/api/impl/fulltext/integrations/bloom/BloomIT.java b/enterprise/fulltext-addon/src/test/java/org/neo4j/kernel/api/impl/fulltext/integrations/bloom/BloomIT.java index 95d1dccd3562e..989d4988642af 100644 --- a/enterprise/fulltext-addon/src/test/java/org/neo4j/kernel/api/impl/fulltext/integrations/bloom/BloomIT.java +++ b/enterprise/fulltext-addon/src/test/java/org/neo4j/kernel/api/impl/fulltext/integrations/bloom/BloomIT.java @@ -516,8 +516,8 @@ public void shouldBeAbleToRunConsistencyCheck() throws Exception @Test public void shouldReindexNodesWhenAnalyzerIsChanged() throws Exception { - String ENGLISH = EnglishAnalyzer.class.getCanonicalName(); - String SWEDISH = SwedishAnalyzer.class.getCanonicalName(); + final String ENGLISH = EnglishAnalyzer.class.getCanonicalName(); + final String SWEDISH = SwedishAnalyzer.class.getCanonicalName(); builder.setConfig( BloomFulltextConfig.bloom_default_analyzer, ENGLISH ); diff --git a/enterprise/ha/src/test/java/org/neo4j/kernel/ha/com/master/MasterImplTest.java b/enterprise/ha/src/test/java/org/neo4j/kernel/ha/com/master/MasterImplTest.java index 015e8a62d9b78..81841dd003e74 100644 --- a/enterprise/ha/src/test/java/org/neo4j/kernel/ha/com/master/MasterImplTest.java +++ b/enterprise/ha/src/test/java/org/neo4j/kernel/ha/com/master/MasterImplTest.java @@ -315,7 +315,7 @@ public void shouldAllowCommitIfClientHoldsNoLocks() throws Throwable master.start(); HandshakeResult handshake = master.handshake( 1, newStoreIdForCurrentVersion() ).response(); - int no_lock_session = -1; + final int no_lock_session = -1; RequestContext ctx = new RequestContext( handshake.epoch(), 1, no_lock_session, 0, 0 ); TransactionRepresentation tx = mock( TransactionRepresentation.class ); diff --git a/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java b/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java index f77d46df36867..71392bc941d0f 100644 --- a/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java +++ b/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java @@ -379,7 +379,7 @@ public void shouldListUsedUniqueIndexes() throws Exception public void shouldListIndexesUsedForScans() throws Exception { // given - String QUERY = "MATCH (n:Node) USING INDEX n:Node(value) WHERE 1 < n.value < 10 SET n.value = 2"; + final String QUERY = "MATCH (n:Node) USING INDEX n:Node(value) WHERE 1 < n.value < 10 SET n.value = 2"; try ( Transaction tx = db.beginTx() ) { db.schema().indexFor( label( "Node" ) ).on( "value" ).create(); @@ -517,7 +517,7 @@ public void heapAllocationTrackingShouldBeADynamicSetting() throws Exception private void shouldListUsedIndexes( String label, String property ) throws Exception { // given - String QUERY1 = "MATCH (n:" + label + "{" + property + ":5}) USING INDEX n:" + label + "(" + property + + final String QUERY1 = "MATCH (n:" + label + "{" + property + ":5}) USING INDEX n:" + label + "(" + property + ") SET n." + property + " = 3"; try ( Resource test = test( () -> { @@ -541,7 +541,7 @@ private void shouldListUsedIndexes( String label, String property ) throws Excep } // given - String QUERY2 = "MATCH (n:" + label + "{" + property + ":3}) USING INDEX n:" + label + "(" + property + + final String QUERY2 = "MATCH (n:" + label + "{" + property + ":3}) USING INDEX n:" + label + "(" + property + ") MATCH (u:" + label + "{" + property + ":4}) USING INDEX u:" + label + "(" + property + ") CREATE (n)-[:KNOWS]->(u)"; try ( Resource test = test( () -> diff --git a/enterprise/management/src/main/java/org/neo4j/management/impl/BeanProxy.java b/enterprise/management/src/main/java/org/neo4j/management/impl/BeanProxy.java index df3f8a9b4f3db..30f24666b65e1 100644 --- a/enterprise/management/src/main/java/org/neo4j/management/impl/BeanProxy.java +++ b/enterprise/management/src/main/java/org/neo4j/management/impl/BeanProxy.java @@ -61,8 +61,8 @@ private BeanProxy() { try { - Class JMX = Class.forName( "javax.management.JMX" ); - this.newMXBeanProxy = JMX.getMethod( "newMXBeanProxy", MBeanServerConnection.class, ObjectName.class, Class.class ); + Class jmx = Class.forName( "javax.management.JMX" ); + this.newMXBeanProxy = jmx.getMethod( "newMXBeanProxy", MBeanServerConnection.class, ObjectName.class, Class.class ); } catch ( ClassNotFoundException | NoSuchMethodException e ) {