From 3e00289b3c3b9710bd954113ad5c3e9d51f09fc2 Mon Sep 17 00:00:00 2001 From: Dave Brosius Date: Sat, 2 Nov 2024 12:17:28 -0400 Subject: [PATCH] update dependencies for sample --- etc/samples.fbp | 71 +++--- src/samples/java/ex/FCBL_Sample.java | 367 ++++++++++++++------------- 2 files changed, 232 insertions(+), 206 deletions(-) diff --git a/etc/samples.fbp b/etc/samples.fbp index 933ddc6df..75520f141 100755 --- a/etc/samples.fbp +++ b/etc/samples.fbp @@ -1,37 +1,38 @@ - ../target/classes/samples - ../lib/asm-debug-all-5.0.2.jar - ../lib/backport-util-concurrent-3.1.jar - ../lib/commons-codec-1.16.0.jar - ../lib/commons-collections-3.2.2.jar - ../lib/commons-lang3-3.14.0.jar - ../lib/guava-33.0.0-jre.jar - ../lib/httpclient-4.5.2.jar - ../lib/httpclient-cache-4.5.2.jar - ../lib/httpcore-4.4.5.jar - ../lib/javax.persistence-2.1.1.jar - ../lib/javax.servlet-api-3.1.0.jar - ../lib/javax.servlet.jsp-api-2.3.1.jar - ../lib/junit-4.12.jar - ../lib/log4j-1.2.17.jar - ../lib/slf4j-api-1.7.21.jar - ../lib/spring-beans-4.3.3.RELEASE.jar - ../lib/spring-context-4.3.3.RELEASE.jar - ../lib/spring-tx-4.3.3.RELEASE.jar - ../lib/threetenbp-1.3.2.jar - ../lib/jena-shaded-guava-3.1.0.jar - ../lib/commons-io-2.4.jar - ../lib/testng-6.9.10.jar - ../lib/javax.ws.rs-api-2.0.1.jar - ../lib/jersey-media-multipart-2.25.1.jar - ../lib/mockito-core-2.23.4.jar - ../lib/hamcrest-core-1.3.jar - ../lib/log4j-api-2.9.1.jar - ../lib/hamcrest-library-1.3.jar - ../lib/akka-actor_2.12-2.6.4.jar - ../lib/akka-http_2.12-10.1.11.jar - ../lib/scala-library-2.12.10.jar - ../lib/akka-http-core_2.12-10.1.11.jar - ../lib/akka-stream_2.12-2.6.4.jar - ../src/samples/java + ./../target/classes/samples + ./../lib/asm-debug-all-5.0.2.jar + ./../lib/backport-util-concurrent-3.1.jar + ./../lib/commons-codec-1.16.0.jar + ./../lib/commons-collections-3.2.2.jar + ./../lib/commons-lang3-3.14.0.jar + ./../lib/guava-33.0.0-jre.jar + ./../lib/httpclient-4.5.2.jar + ./../lib/httpclient-cache-4.5.2.jar + ./../lib/httpcore-4.4.5.jar + ./../lib/javax.persistence-2.1.1.jar + ./../lib/log4j-1.2.17.jar + ./../lib/slf4j-api-1.7.21.jar + ./../lib/spring-beans-4.3.3.RELEASE.jar + ./../lib/spring-context-4.3.3.RELEASE.jar + ./../lib/spring-tx-4.3.3.RELEASE.jar + ./../lib/threetenbp-1.3.2.jar + ./../lib/jena-shaded-guava-3.1.0.jar + ./../lib/testng-6.9.10.jar + ./../lib/javax.ws.rs-api-2.0.1.jar + ./../lib/jersey-media-multipart-2.25.1.jar + ./../lib/mockito-core-2.23.4.jar + ./../lib/hamcrest-core-1.3.jar + ./../lib/log4j-api-2.9.1.jar + ./../lib/hamcrest-library-1.3.jar + ./../lib/akka-actor_2.12-2.6.4.jar + ./../lib/akka-http_2.12-10.1.11.jar + ./../lib/scala-library-2.12.10.jar + ./../lib/akka-http-core_2.12-10.1.11.jar + ./../lib/akka-stream_2.12-2.6.4.jar + ../lib/javax.servlet.jsp-api-2.3.3.jar + ../lib/junit-4.13.2.jar + ../lib/javax.servlet-api-4.0.1.jar + ../lib/jakarta.xml.bind-api-2.3.3.jar + ../lib/commons-io-2.15.1.jar + ./../src/samples/java diff --git a/src/samples/java/ex/FCBL_Sample.java b/src/samples/java/ex/FCBL_Sample.java index d824e6913..6b89b0d4b 100755 --- a/src/samples/java/ex/FCBL_Sample.java +++ b/src/samples/java/ex/FCBL_Sample.java @@ -12,183 +12,208 @@ @SuppressWarnings("all") public final class FCBL_Sample { - public int foo; // no warning (scope) - private int moo; // warning - private int boo; // warning - int hoo; // no warning (scope) - private int fp; // no warning (read in method test2) - private int multiMethodFP; // no warning (used in a couple methods) - private String test; // warning - private String testNestedIfs;// no warning (in one branch of the if, this is - // read first) - private int x = 1; // warning - private int y = 2; // no warning (read first in method1) - private boolean ret; // warning (shielded in foo) - @FooAnnotation - private String notUsed; // warning - @FooAnnotation - private String used; // no warning (annotation+stored) - - private String fooS = "Foo"; // warning - private String[] fooSS = { fooS }; // no warning (read in testInArray) - - private boolean checkMethodCall; - - public FCBL_Sample() { - foo = 0; - moo = 1; - boo = 2; - hoo = 3; - fp = 4; - used = "Hello"; - ret = false; - - // to mask standard URF_UNREAD_FIELD - System.out.println(foo + hoo + used + moo + boo + ret); - } - - public void method1() { - x = 50; - System.out.println(x); - System.out.println(y); - } - - public void test1() { - foo = 2; - moo = 3; - boo = 4; - fp = 5; - } - - public void testInArray() { - for (String s : fooSS) { - } - } - - public void test2() { - boo = fp; - } - - public void test3(String in) { - boolean found = false; - if ("boo".equals(in)) { - test = "boo"; - } else if ("hoo".equals(in)) { - test = "hoo"; - } else if ("moo".equals(in)) { - if ("loo".equals(in) && !found) { - found = true; - } - } - - test = "WooWoo".toLowerCase(Locale.ENGLISH); // hides the PME warning - // and the standard - // DM_CONVERT_CASE - if (in.length() > 1) { - test = "woowoo"; - System.out.println(test); - } - } - - public void testNestedIfs(String in) { - boolean found = false; - if ("boo".equals(in)) { - testNestedIfs = "boo"; - } else if ("hoo".equals(in)) { - testNestedIfs = "hoo"; - } else if ("moo".equals(in)) { - if ("loo".equals(in) && !found) { - System.out.println(in + testNestedIfs); - } - } - - testNestedIfs = "WooWoo".toLowerCase(Locale.ENGLISH); // hides the PME - // warning and the - // standard - // DM_CONVERT_CASE - if (in.length() > 1) { - testNestedIfs = "woowoo"; - } - } - - public void mm1FP(int i) { - multiMethodFP = i; - mm2FP(3); - - if (multiMethodFP == i) { - System.out.println("FP"); - } - } - - public void mm2FP(int i) { - multiMethodFP = i; - } - - public void baseMethod() { - checkMethodCall = false; - setCheckMethod(); - - if (checkMethodCall) { - System.out.println("It changed"); - } - } - - public void setCheckMethod() { - if (Math.random() < 0.05) { - checkMethodCall = true; - } - } - - static class Foo { - boolean ret; - - public boolean testFPAnon() { - ret = false; - - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - ret = false; - } - }); - - return ret; - } - } - - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.FIELD) - @interface FooAnnotation { - - } - - static class FieldNameCollisionFP { - OutputStream out; - - public FieldNameCollisionFP(OutputStream out) { - this.out = out; - } - - public void collide() throws IOException { - System.out.println("See out!"); - out.close(); - } - } + public int foo; // no warning (scope) + private int moo; // warning + private int boo; // warning + int hoo; // no warning (scope) + private int fp; // no warning (read in method test2) + private int multiMethodFP; // no warning (used in a couple methods) + private String test; // warning + private String testNestedIfs;// no warning (in one branch of the if, this is + // read first) + private int x = 1; // warning + private int y = 2; // no warning (read first in method1) + private boolean ret; // warning (shielded in foo) + @FooAnnotation + private String notUsed; // warning + @FooAnnotation + private String used; // no warning (annotation+stored) + + private String fooS = "Foo"; // warning + private String[] fooSS = { fooS }; // no warning (read in testInArray) + + private boolean checkMethodCall; + + public FCBL_Sample() { + foo = 0; + moo = 1; + boo = 2; + hoo = 3; + fp = 4; + used = "Hello"; + ret = false; + + // to mask standard URF_UNREAD_FIELD + System.out.println(foo + hoo + used + moo + boo + ret); + } + + public void method1() { + x = 50; + System.out.println(x); + System.out.println(y); + } + + public void test1() { + foo = 2; + moo = 3; + boo = 4; + fp = 5; + } + + public void testInArray() { + for (String s : fooSS) { + } + } + + public void test2() { + boo = fp; + } + + public void test3(String in) { + boolean found = false; + if ("boo".equals(in)) { + test = "boo"; + } else if ("hoo".equals(in)) { + test = "hoo"; + } else if ("moo".equals(in)) { + if ("loo".equals(in) && !found) { + found = true; + } + } + + test = "WooWoo".toLowerCase(Locale.ENGLISH); // hides the PME warning + // and the standard + // DM_CONVERT_CASE + if (in.length() > 1) { + test = "woowoo"; + System.out.println(test); + } + } + + public void testNestedIfs(String in) { + boolean found = false; + if ("boo".equals(in)) { + testNestedIfs = "boo"; + } else if ("hoo".equals(in)) { + testNestedIfs = "hoo"; + } else if ("moo".equals(in)) { + if ("loo".equals(in) && !found) { + System.out.println(in + testNestedIfs); + } + } + + testNestedIfs = "WooWoo".toLowerCase(Locale.ENGLISH); // hides the PME + // warning and the + // standard + // DM_CONVERT_CASE + if (in.length() > 1) { + testNestedIfs = "woowoo"; + } + } + + public void mm1FP(int i) { + multiMethodFP = i; + mm2FP(3); + + if (multiMethodFP == i) { + System.out.println("FP"); + } + } + + public void mm2FP(int i) { + multiMethodFP = i; + } + + public void baseMethod() { + checkMethodCall = false; + setCheckMethod(); + + if (checkMethodCall) { + System.out.println("It changed"); + } + } + + public void setCheckMethod() { + if (Math.random() < 0.05) { + checkMethodCall = true; + } + } + + static class Foo { + boolean ret; + + public boolean testFPAnon() { + ret = false; + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + ret = false; + } + }); + + return ret; + } + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.FIELD) + @interface FooAnnotation { + + } + + static class FieldNameCollisionFP { + OutputStream out; + + public FieldNameCollisionFP(OutputStream out) { + this.out = out; + } + + public void collide() throws IOException { + System.out.println("See out!"); + out.close(); + } + } } interface I320 { - void doStuff(); + void doStuff(); } class FP320 implements I320 { - private final String s; + private final String s; - public FP320(String s) { - this.s = s; - } + public FP320(String s) { + this.s = s; + } - @Override - public void doStuff() { - System.out.println(s); - } + @Override + public void doStuff() { + System.out.println(s); + } +} + +final class FP460 { + public final Type type; + public final String id; + + public FP460(Type type, String id) { + this.type = (type); + this.id = (id); + } + + @Override + public String toString() { + return type.displayName + " <" + id + ">"; + } + + public enum Type { + FOO("Foolicious"), BAR("Barocious"); + + private final String displayName; + + private Type(String displayName) { + this.displayName = displayName; + } + }; }