From d7fb6a7bcfbd2d5ac452abdcdd31fb4d71441c70 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Mon, 15 Oct 2012 23:49:08 -0700 Subject: gluegen: generics annotations for various ArrayList/List use - Use the copy constructor rather than ArrayList.clone() - constrain listsEqual so the compiler will warn about comparing lists of different types Signed-off-by: Harvey Harrison --- src/java/com/jogamp/common/util/IntIntHashMap.java | 2 +- src/java/com/jogamp/gluegen/cgram/types/CompoundType.java | 2 +- src/java/com/jogamp/gluegen/cgram/types/EnumType.java | 2 +- src/java/com/jogamp/gluegen/cgram/types/FunctionType.java | 4 ++-- src/java/com/jogamp/gluegen/cgram/types/Type.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/java/com/jogamp/common/util/IntIntHashMap.java b/src/java/com/jogamp/common/util/IntIntHashMap.java index 487914b..5146d44 100644 --- a/src/java/com/jogamp/common/util/IntIntHashMap.java +++ b/src/java/com/jogamp/common/util/IntIntHashMap.java @@ -152,7 +152,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable, Iterable { for(int i=table.length-1; i>=0; i--) { // single linked list -> ArrayList - final ArrayList entries = new ArrayList(); + final ArrayList entries = new ArrayList(); Entry se = table[i]; while(null != se) { entries.add(se); diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java index a4b419f..746212d 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java @@ -74,7 +74,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable public Object clone() { CompoundType n = (CompoundType) super.clone(); if(null!=this.fields) { - n.fields = (ArrayList) this.fields.clone(); + n.fields = new ArrayList(this.fields); } return n; } diff --git a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java index 7967ba0..d21774f 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java @@ -91,7 +91,7 @@ public class EnumType extends IntType implements Cloneable { n.underlyingType = (IntType) this.underlyingType.clone(); } if(null!=this.enums) { - n.enums = (ArrayList) this.enums.clone(); + n.enums = new ArrayList(this.enums); } return n; } diff --git a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java index 4c908dc..fcaf97b 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java @@ -57,10 +57,10 @@ public class FunctionType extends Type implements Cloneable { public Object clone() { FunctionType n = (FunctionType) super.clone(); if(null!=this.argumentTypes) { - n.argumentTypes = (ArrayList) this.argumentTypes.clone(); + n.argumentTypes = new ArrayList(this.argumentTypes); } if(null!=this.argumentNames) { - n.argumentNames = (ArrayList) this.argumentNames.clone(); + n.argumentNames = new ArrayList(this.argumentNames); } return n; } diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java index 281f35c..cffbb67 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Type.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java @@ -269,7 +269,7 @@ public abstract class Type implements Cloneable { } /** Helper routine for list equality comparison */ - static boolean listsEqual(List a, List b) { + static boolean listsEqual(List a, List b) { return ((a == null && b == null) || (a != null && b != null && a.equals(b))); } } -- cgit v1.2.3 From 28410cfb398b510b4f748f3a1134dd13dae9f7c4 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Tue, 16 Oct 2012 00:12:56 -0700 Subject: gluegen: remove two fast-path tests that can never trigger ignores and unimplemented are both Set, they cannot contain a String, immediately after these 'fast paths' we loop over the patterns calling .matches() which makes sense, so remove the misleading tests. Signed-off-by: Harvey Harrison --- src/java/com/jogamp/gluegen/JavaConfiguration.java | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/java/com/jogamp/gluegen/JavaConfiguration.java b/src/java/com/jogamp/gluegen/JavaConfiguration.java index d1cb46a..fa77a17 100644 --- a/src/java/com/jogamp/gluegen/JavaConfiguration.java +++ b/src/java/com/jogamp/gluegen/JavaConfiguration.java @@ -717,14 +717,6 @@ public class JavaConfiguration { return true; } } - - // Simple case; the entire symbol is in the ignore table. - if (ignores.contains(symbol)) { - if(DEBUG_IGNORES) { - System.err.println("Ignore Impl ignores: "+symbol); - } - return true; - } // Ok, the slow case. We need to check the entire table, in case the table // contains an regular expression that matches the symbol. @@ -779,12 +771,6 @@ public class JavaConfiguration { throws a run-time exception with an "unimplemented" message during glue code generation. */ public boolean isUnimplemented(String symbol) { - - // Simple case; the entire symbol is in the ignore table. - if (unimplemented.contains(symbol)) { - return true; - } - // Ok, the slow case. We need to check the entire table, in case the table // contains an regular expression that matches the symbol. for (Pattern regexp : unimplemented) { -- cgit v1.2.3 From 4309d1334a2b036c7bf15612199bb7391a57980b Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Tue, 16 Oct 2012 00:21:43 -0700 Subject: gluegen: replace Thread name with name of lock file in SingletonInstanceFileLock error message The getName() call here is currently calling Thread.getName() inherited by the anonymous inner class. This is ambiguous, and likely meant to call the getName() method of SingletonInstanceFileLock, which would output the lockfile name. In any event, infoPrefix() is already adding the Thread name for us. Signed-off-by: Harvey Harrison --- src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java index a76f261..42d125a 100644 --- a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java +++ b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java @@ -80,7 +80,7 @@ public class SingletonInstanceFileLock extends SingletonInstance { @Override public void run() { if(isLocked()) { - System.err.println(infoPrefix()+" XXX "+getName()+" - Unlock @ JVM Shutdown"); + System.err.println(infoPrefix()+" XXX "+SingletonInstanceFileLock.this.getName()+" - Unlock @ JVM Shutdown"); } unlock(); } -- cgit v1.2.3