Skip to content

Commit 7393945

Browse files
committed
Allow warnings to be generated
1 parent 2845af8 commit 7393945

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

JavaProjectGenerator/src/de/loskutov/jpg/Clazz.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ String generateCode() {
3131
}
3232

3333
String generateTypeDefinition(String type) {
34+
String result = "";
35+
if (hideWarnings) {
36+
result = "@SuppressWarnings(\"all\")\n";
37+
}
3438
if(useExtend) {
35-
return "@SuppressWarnings(\"all\")\n" +
36-
"public abstract class " + name + "<"+type+"> extends " + extend + "<"+type+"> implements " + implement + "<"+type+"> ";
39+
return result + "public abstract class " + name + "<"+type+"> extends " + extend + "<"+type+"> implements " + implement + "<"+type+"> ";
3740
}
38-
return "@SuppressWarnings(\"all\")\n" +
39-
"public abstract class " + name + "<"+type+"> ";
41+
return result + "public abstract class " + name + "<"+type+"> ";
4042
}
4143

4244
String generateClassFields(String type) {

JavaProjectGenerator/src/de/loskutov/jpg/JavaElement.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public abstract class JavaElement {
2222
static int methodCounts = 1;
2323
static int runnablesAndCallablesCounts = 1;
2424
static boolean useExtend = true;
25+
static boolean hideWarnings = true;
2526

2627
static final List<String> IMPORTS = Arrays.asList(
2728
"java.awt.datatransfer.*",

JavaProjectGenerator/src/de/loskutov/jpg/Main.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public static void main(String[] args) throws IOException {
3030
int methods = 1; // result method count will be (methods x 6 + runnablesAndCallables x 2)
3131
int runnablesAndCallables = 1;
3232
boolean extend = true;
33+
boolean hideWarnings = true;
3334

3435
if(args.length == 0) {
3536
System.out.println("No arguments given, using defaults");
@@ -65,6 +66,7 @@ public static void main(String[] args) throws IOException {
6566
JavaElement.methodCounts = methods;
6667
JavaElement.runnablesAndCallablesCounts = runnablesAndCallables;
6768
JavaElement.useExtend = extend;
69+
JavaElement.hideWarnings = hideWarnings;
6870

6971
new JavaBuilder(depth, roots, classes, root).build();
7072
}

0 commit comments

Comments
 (0)