[commons-numbers] 04/04: Add Stirling s2 example to the user guide test
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-numbers.git commit 3aa69eef7c7062d1612dcccbf25c719b061e0efb Author: aherbert AuthorDate: Wed Nov 9 12:33:10 2022 + Add Stirling s2 example to the user guide test --- .../org/apache/commons/numbers/combinatorics/UserGuideTest.java| 7 +++ 1 file changed, 7 insertions(+) diff --git a/commons-numbers-combinatorics/src/test/java/org/apache/commons/numbers/combinatorics/UserGuideTest.java b/commons-numbers-combinatorics/src/test/java/org/apache/commons/numbers/combinatorics/UserGuideTest.java index 38ef9c6d..5186da00 100644 --- a/commons-numbers-combinatorics/src/test/java/org/apache/commons/numbers/combinatorics/UserGuideTest.java +++ b/commons-numbers-combinatorics/src/test/java/org/apache/commons/numbers/combinatorics/UserGuideTest.java @@ -91,4 +91,11 @@ class UserGuideTest { "[3, 4, 5]" ), actual); } + +@Test +void testStirlingS2() { +Assertions.assertEquals(1, Stirling.stirlingS2(3, 1)); +Assertions.assertEquals(3, Stirling.stirlingS2(3, 2)); +Assertions.assertEquals(1, Stirling.stirlingS2(3, 3)); +} }
[commons-numbers] 01/04: Numbers-191: Compute Stirling number of the first kind
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-numbers.git commit 2ec97e42be39f410a06a3ba9c60f89ddea65614c Author: Alex Herbert AuthorDate: Mon Nov 7 17:25:35 2022 + Numbers-191: Compute Stirling number of the first kind --- .../commons/numbers/combinatorics/Stirling.java| 174 ++--- .../numbers/combinatorics/StirlingTest.java| 211 +++-- 2 files changed, 343 insertions(+), 42 deletions(-) diff --git a/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Stirling.java b/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Stirling.java index d5250fc4..2d301eae 100644 --- a/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Stirling.java +++ b/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Stirling.java @@ -23,11 +23,47 @@ package org.apache.commons.numbers.combinatorics; * @since 1.2 */ public final class Stirling { +/** Stirling S1 error message. */ +private static final String S1_ERROR_FORMAT = "s(n=%d, k=%d)"; /** Stirling S2 error message. */ private static final String S2_ERROR_FORMAT = "S(n=%d, k=%d)"; +/** Overflow threshold for n when computing s(n, 1). */ +private static final int S1_OVERFLOW_K_EQUALS_1 = 21; +/** Overflow threshold for n when computing s(n, n-2). */ +private static final int S1_OVERFLOW_K_EQUALS_NM2 = 92682; +/** Overflow threshold for n when computing s(n, n-3). */ +private static final int S1_OVERFLOW_K_EQUALS_NM3 = 2761; /** Overflow threshold for n when computing S(n, n-2). */ private static final int S2_OVERFLOW_K_EQUALS_NM2 = 92683; +/** + * Precomputed Stirling numbers of the first kind. + * Provides a thread-safe lazy initialization of the cache. + */ +private static class StirlingS1Cache { +/** Maximum n to compute (exclusive). + * As s(21,3) = 13803759753640704000 is larger than Long.MAX_VALUE + * we must stop computation at row 21. */ +static final int MAX_N = 21; +/** Stirling numbers of the first kind. */ +static final long[][] S1; + +static { +S1 = new long[MAX_N][]; +// Initialise first two rows to allow s(2, 1) to use s(1, 1) +S1[0] = new long[] {1}; +S1[1] = new long[] {0, 1}; +for (int n = 2; n < S1.length; n++) { +S1[n] = new long[n + 1]; +S1[n][0] = 0; +S1[n][n] = 1; +for (int k = 1; k < n; k++) { +S1[n][k] = S1[n - 1][k - 1] - (n - 1) * S1[n - 1][k]; +} +} +} +} + /** * Precomputed Stirling numbers of the second kind. * Provides a thread-safe lazy initialization of the cache. @@ -38,18 +74,18 @@ public final class Stirling { * we must stop computation at row 26. */ static final int MAX_N = 26; /** Stirling numbers of the second kind. */ -static final long[][] STIRLING_S2; +static final long[][] S2; static { -STIRLING_S2 = new long[MAX_N][]; -STIRLING_S2[0] = new long[] {1}; -for (int n = 1; n < STIRLING_S2.length; n++) { -STIRLING_S2[n] = new long[n + 1]; -STIRLING_S2[n][0] = 0; -STIRLING_S2[n][1] = 1; -STIRLING_S2[n][n] = 1; +S2 = new long[MAX_N][]; +S2[0] = new long[] {1}; +for (int n = 1; n < S2.length; n++) { +S2[n] = new long[n + 1]; +S2[n][0] = 0; +S2[n][1] = 1; +S2[n][n] = 1; for (int k = 2; k < n; k++) { -STIRLING_S2[n][k] = k * STIRLING_S2[n - 1][k] + STIRLING_S2[n - 1][k - 1]; +S2[n][k] = k * S2[n - 1][k] + S2[n - 1][k - 1]; } } } @@ -60,6 +96,81 @@ public final class Stirling { // intentionally empty. } +/** + * Returns the signed https://mathworld.wolfram.com/StirlingNumberoftheFirstKind.html";> + * Stirling number of the first kind, "{@code s(n,k)}". The number of permutations of + * {@code n} elements which contain exactly {@code k} permutation cycles is the + * nonnegative number: {@code |s(n,k)| = (-1)^(n-k) s(n,k)} + * + * @param n Size of the set + * @param k Number of permutation cycles ({@code 0 <= k <= n}) + * @return {@code s(n,k)} + * @throws IllegalArgumentException if {@code n < 0}, {@code k < 0} or {@code k > n}. + * @throws ArithmeticException if some overflow happens, typically for n exceeding 20 + * (s(n,n-1) is handled specifically and does not overflow) + */ +public sta
[commons-numbers] 03/04: Add Stirling number of the first kind to the user guide
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-numbers.git commit 517b60d4db51eb60274c879850804abf1e779d67 Author: aherbert AuthorDate: Wed Nov 9 12:27:30 2022 + Add Stirling number of the first kind to the user guide --- src/site/apt/userguide/index.apt | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/site/apt/userguide/index.apt b/src/site/apt/userguide/index.apt index c7c3f672..f140f894 100644 --- a/src/site/apt/userguide/index.apt +++ b/src/site/apt/userguide/index.apt @@ -295,7 +295,10 @@ list.forEach(c -> System.out.println(Arrays.toString(c))); [3, 4, 5] +--+ - The <<>> class can evaluate Stirling numbers of the second kind \( S(n, k) \). This is + The <<>> class can evaluate Stirling numbers of the first kind and second kind. + The Stirling numbers of the first kind \( s(n, k) \) arise in the study of permutations, + particularly counting the permutations of a set according to their number of cycles. + The Stirling number of the second kind \( S(n, k) \) is the number of ways of partitioning a set of \( n \) elements into \( k \) non-empty subsets. For example a set of 3 elements may be partitioned into:
[commons-numbers] 02/04: Track changes
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-numbers.git commit 43e895d54569a5c0a6393aff28d4387c51f88332 Author: aherbert AuthorDate: Wed Nov 9 12:17:51 2022 + Track changes --- src/changes/changes.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index e0eb6047..569fdc6b 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -56,6 +56,9 @@ If the output is not quite correct, check for invisible trailing spaces! + +"Stirling": Compute Stirling numbers of the first kind. + Add "Stirling" class to compute Stirling numbers of the second kind.
[commons-numbers] branch master updated (2ff71a05 -> 3aa69eef)
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/commons-numbers.git from 2ff71a05 Add additional stirlingS2 test cases new 2ec97e42 Numbers-191: Compute Stirling number of the first kind new 43e895d5 Track changes new 517b60d4 Add Stirling number of the first kind to the user guide new 3aa69eef Add Stirling s2 example to the user guide test The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../commons/numbers/combinatorics/Stirling.java| 174 ++--- .../numbers/combinatorics/StirlingTest.java| 211 +++-- .../numbers/combinatorics/UserGuideTest.java | 7 + src/changes/changes.xml| 3 + src/site/apt/userguide/index.apt | 5 +- 5 files changed, 357 insertions(+), 43 deletions(-)
[commons-collections] branch master updated: Whitespace formatting
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git The following commit(s) were added to refs/heads/master by this push: new 69cad46a9 Whitespace formatting 69cad46a9 is described below commit 69cad46a9249d7f0308547e2a0bfd5c959872feb Author: aherbert AuthorDate: Wed Nov 9 12:50:06 2022 + Whitespace formatting --- .../commons/collections4/bloomfilter/AbstractBloomFilterTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java index 1098ee492..d44ed9d59 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java @@ -44,7 +44,7 @@ public abstract class AbstractBloomFilterTest { new IncrementingHasher(17, 1)/* 17-33 */, new IncrementingHasher(33, 1)/* 33-49 */, new IncrementingHasher(50, 1)/* 50-66 */, new IncrementingHasher(67, 1)/* 67-83 */ ); -protected final long[] fullHashValue = { 0xL, 0xfL }; +protected final long[] fullHashValue = {0xL, 0xfL}; /** * The shape of the Bloom filters for testing.
[commons-bcel] branch master updated: More accurate description
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git The following commit(s) were added to refs/heads/master by this push: new db90cef6 More accurate description db90cef6 is described below commit db90cef65f10feaae05b07b6845be88285d16faf Author: Gary David Gregory (Code signing key) AuthorDate: Wed Nov 9 10:54:24 2022 -0500 More accurate description --- src/changes/changes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 83d8137d..ee8d09e1 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -65,7 +65,7 @@ The type attribute can be add,update,fix,remove. Typo in SimpleElementValue error message #161. - Fix small performance bug in org.apache.bcel.verifier.structurals.ExceptionHandlers.ExceptionHandlers(MethodGen). + Fix code duplication in org.apache.bcel.verifier.structurals.ExceptionHandlers.ExceptionHandlers(MethodGen). Improve test coverage to bcel/generic and UtilityTest #162.
[commons-bcel] branch master updated: Use final
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git The following commit(s) were added to refs/heads/master by this push: new bb988482 Use final bb988482 is described below commit bb988482b01028a015e3c2169d64975bb853502d Author: Gary David Gregory (Code signing key) AuthorDate: Wed Nov 9 11:05:30 2022 -0500 Use final --- .../java/org/apache/bcel/generic/ConstantPoolGen.java| 16 src/main/java/org/apache/bcel/generic/MethodGen.java | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java index e47ca57b..cf7ff315 100644 --- a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java +++ b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java @@ -358,8 +358,8 @@ public class ConstantPoolGen { return cpRet; // Already in CP } adjustSize(); -int classIndex = addClass(className); -int nameAndTypeIndex = addNameAndType(fieldName, signature); +final int classIndex = addClass(className); +final int nameAndTypeIndex = addNameAndType(fieldName, signature); final int ret = index; constants[index++] = new ConstantFieldref(classIndex, nameAndTypeIndex); return computeIfAbsent(cpTable, className + FIELDREF_DELIM + fieldName + FIELDREF_DELIM + signature, ret); @@ -417,8 +417,8 @@ public class ConstantPoolGen { return cpRet; // Already in CP } adjustSize(); -int classIndex = addClass(className); -int nameAndTypeIndex = addNameAndType(methodName, signature); +final int classIndex = addClass(className); +final int nameAndTypeIndex = addNameAndType(methodName, signature); final int ret = index; constants[index++] = new ConstantInterfaceMethodref(classIndex, nameAndTypeIndex); return computeIfAbsent(cpTable, className + IMETHODREF_DELIM + methodName + IMETHODREF_DELIM + signature, ret); @@ -459,8 +459,8 @@ public class ConstantPoolGen { return cpRet; // Already in CP } adjustSize(); -int nameAndTypeIndex = addNameAndType(methodName, signature); -int classIndex = addClass(className); +final int nameAndTypeIndex = addNameAndType(methodName, signature); +final int classIndex = addClass(className); final int ret = index; constants[index++] = new ConstantMethodref(classIndex, nameAndTypeIndex); return computeIfAbsent(cpTable, className + METHODREF_DELIM + methodName + METHODREF_DELIM + signature, ret); @@ -479,8 +479,8 @@ public class ConstantPoolGen { return ret; // Already in CP } adjustSize(); -int nameIndex = addUtf8(name); -int signatureIndex = addUtf8(signature); +final int nameIndex = addUtf8(name); +final int signatureIndex = addUtf8(signature); ret = index; constants[index++] = new ConstantNameAndType(nameIndex, signatureIndex); return computeIfAbsent(natTable, name + NAT_DELIM + signature, ret); diff --git a/src/main/java/org/apache/bcel/generic/MethodGen.java b/src/main/java/org/apache/bcel/generic/MethodGen.java index a97bc9d7..afe7dfa0 100644 --- a/src/main/java/org/apache/bcel/generic/MethodGen.java +++ b/src/main/java/org/apache/bcel/generic/MethodGen.java @@ -800,7 +800,7 @@ public class MethodGen extends FieldGenOrMethodGen { /* * Also updates positions of instructions, i.e., their indices */ -byte[] byteCode = il != null ? il.getByteCode() : null; +final byte[] byteCode = il != null ? il.getByteCode() : null; LineNumberTable lnt = null; LocalVariableTable lvt = null; /*
[commons-bcel] branch master updated (bb988482 -> e57f90c9)
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git from bb988482 Use final new 2e70012a Clean up whitespace new 17e5de3c Remove redundant call to super() new e57f90c9 Use blocks and final The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../ConstantPoolModuleToStringTestCase.java| 4 +- .../org/apache/bcel/generic/CountingVisitor.java | 737 +++-- .../java/org/apache/bcel/generic/JavaHome.java | 1 - 3 files changed, 372 insertions(+), 370 deletions(-)
[commons-bcel] 03/03: Use blocks and final
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git commit e57f90c9ef3121b37d024eb275e1cd138082e33d Author: Gary David Gregory (Code signing key) AuthorDate: Wed Nov 9 11:10:54 2022 -0500 Use blocks and final --- .../org/apache/bcel/generic/CountingVisitor.java | 737 +++-- 1 file changed, 370 insertions(+), 367 deletions(-) diff --git a/src/test/java/org/apache/bcel/generic/CountingVisitor.java b/src/test/java/org/apache/bcel/generic/CountingVisitor.java index 2432c21f..ee2bc199 100644 --- a/src/test/java/org/apache/bcel/generic/CountingVisitor.java +++ b/src/test/java/org/apache/bcel/generic/CountingVisitor.java @@ -202,14 +202,17 @@ public class CountingVisitor implements Visitor { private int variableLengthInstruction; @Override -public boolean equals(Object obj) { -if (this == obj) +public boolean equals(final Object obj) { +if (this == obj) { return true; -if (obj == null) +} +if (obj == null) { return false; -if (getClass() != obj.getClass()) +} +if (getClass() != obj.getClass()) { return false; -CountingVisitor other = (CountingVisitor) obj; +} +final CountingVisitor other = (CountingVisitor) obj; return aaload == other.aaload && aastore == other.aastore && aconstNull == other.aconstNull && allocationInstruction == other.allocationInstruction && aload == other.aload && anewarray == other.anewarray && areturn == other.areturn && arithmeticInstruction == other.arithmeticInstruction && arrayInstruction == other.arrayInstruction && arraylength == other.arraylength && astore == other.astore && athrow == other.athrow @@ -994,727 +997,727 @@ public class CountingVisitor implements Visitor { variableLengthInstruction); } -public void setAaload(int aaload) { +public void setAaload(final int aaload) { this.aaload = aaload; } -public void setAastore(int aastore) { +public void setAastore(final int aastore) { this.aastore = aastore; } -public void setAconstNull(int aconstNull) { +public void setAconstNull(final int aconstNull) { this.aconstNull = aconstNull; } -public void setAllocationInstruction(int allocationInstruction) { +public void setAllocationInstruction(final int allocationInstruction) { this.allocationInstruction = allocationInstruction; } -public void setAload(int aload) { +public void setAload(final int aload) { this.aload = aload; } -public void setAnewarray(int anewarray) { +public void setAnewarray(final int anewarray) { this.anewarray = anewarray; } -public void setAreturn(int areturn) { +public void setAreturn(final int areturn) { this.areturn = areturn; } -public void setArithmeticInstruction(int arithmeticInstruction) { +public void setArithmeticInstruction(final int arithmeticInstruction) { this.arithmeticInstruction = arithmeticInstruction; } -public void setArrayInstruction(int arrayInstruction) { +public void setArrayInstruction(final int arrayInstruction) { this.arrayInstruction = arrayInstruction; } -public void setArraylength(int arraylength) { +public void setArraylength(final int arraylength) { this.arraylength = arraylength; } -public void setAstore(int astore) { +public void setAstore(final int astore) { this.astore = astore; } -public void setAthrow(int athrow) { +public void setAthrow(final int athrow) { this.athrow = athrow; } -public void setBaload(int baload) { +public void setBaload(final int baload) { this.baload = baload; } -public void setBastore(int bastore) { +public void setBastore(final int bastore) { this.bastore = bastore; } -public void setBipush(int bipush) { +public void setBipush(final int bipush) { this.bipush = bipush; } -public void setBranchInstruction(int branchInstruction) { +public void setBranchInstruction(final int branchInstruction) { this.branchInstruction = branchInstruction; } -public void setBreakpoint(int breakpoint) { +public void setBreakpoint(final int breakpoint) { this.breakpoint = breakpoint; } -public void setCaload(int caload) { +public void setCaload(final int caload) { this.caload = caload; } -public void setCastore(int castore) { +public void setCastore(final int castore) { this.castore = castore; } -public void setCheckcast(int checkcast) { +public void setCheckcast(final int checkcast) { this.checkcast =
[commons-bcel] 01/03: Clean up whitespace
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git commit 2e70012ae7ef179d7add660c3322b00f35619d5f Author: Gary David Gregory (Code signing key) AuthorDate: Wed Nov 9 11:09:26 2022 -0500 Clean up whitespace --- .../org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java b/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java index d480d667..f683da67 100644 --- a/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java +++ b/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java @@ -473,7 +473,7 @@ public class ConstantPoolModuleToStringTestCase { } } } - + @ParameterizedTest @ValueSource(strings = { // @formatter:off @@ -490,7 +490,7 @@ public class ConstantPoolModuleToStringTestCase { public void testClass(final String className) throws Exception { testJavaClass(SyntheticRepository.getInstance().loadClass(className)); } - + private static void test(final InputStream inputStream) throws IOException { final ClassParser classParser = new ClassParser(inputStream, "module-info.class"); final JavaClass javaClass = classParser.parse();
[commons-bcel] 02/03: Remove redundant call to super()
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git commit 17e5de3cc4beeab6eeb4ed1da24347252c88ad3b Author: Gary David Gregory (Code signing key) AuthorDate: Wed Nov 9 11:10:00 2022 -0500 Remove redundant call to super() --- src/test/java/org/apache/bcel/generic/JavaHome.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/org/apache/bcel/generic/JavaHome.java b/src/test/java/org/apache/bcel/generic/JavaHome.java index 76dcddb6..df96e715 100644 --- a/src/test/java/org/apache/bcel/generic/JavaHome.java +++ b/src/test/java/org/apache/bcel/generic/JavaHome.java @@ -150,7 +150,6 @@ public class JavaHome { private final Path path; private JavaHome(final Path path) { -super(); this.path = Objects.requireNonNull(path, "path"); }
[commons-bcel] branch master updated: No need to nest
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git The following commit(s) were added to refs/heads/master by this push: new 6499d147 No need to nest 6499d147 is described below commit 6499d147014d55500571adfc3444179fb096a84d Author: Gary David Gregory (Code signing key) AuthorDate: Wed Nov 9 14:57:08 2022 -0500 No need to nest --- .../apache/bcel/verifier/statics/Pass2Verifier.java | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java index ba82c084..004c01fa 100644 --- a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java +++ b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java @@ -1411,19 +1411,15 @@ public final class Pass2Verifier extends PassVerifier implements Constants { for (final Method method : methods) { final String nameAndSig = method.getName() + method.getSignature(); -if (map.containsKey(nameAndSig)) { -if (method.isFinal()) { -if (!method.isPrivate()) { -throw new ClassConstraintException("Method '" + nameAndSig + "' in class '" + map.get(nameAndSig) -+ "' overrides the final (not-overridable) definition in class '" + jc.getClassName() + "'."); -} -addMessage("Method '" + nameAndSig + "' in class '" + map.get(nameAndSig) -+ "' overrides the final (not-overridable) definition in class '" + jc.getClassName() -+ "'. This is okay, as the original definition was private; however this constraint leverage" -+ " was introduced by JLS 8.4.6 (not vmspec2) and the behavior of the Sun verifiers."); -} else if (!method.isStatic()) { // static methods don't inherit -map.put(nameAndSig, jc.getClassName()); +if (map.containsKey(nameAndSig) && method.isFinal()) { +if (!method.isPrivate()) { +throw new ClassConstraintException("Method '" + nameAndSig + "' in class '" + map.get(nameAndSig) ++ "' overrides the final (not-overridable) definition in class '" + jc.getClassName() + "'."); } +addMessage("Method '" + nameAndSig + "' in class '" + map.get(nameAndSig) ++ "' overrides the final (not-overridable) definition in class '" + jc.getClassName() ++ "'. This is okay, as the original definition was private; however this constraint leverage" ++ " was introduced by JLS 8.4.6 (not vmspec2) and the behavior of the Sun verifiers."); } else if (!method.isStatic()) { // static methods don't inherit map.put(nameAndSig, jc.getClassName()); }