summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/JavaEmitter.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-12-11 19:05:26 +0100
committerSven Gothel <[email protected]>2014-12-11 19:05:26 +0100
commit558d51e384e8c4e2bf3d4f646724c3351101b605 (patch)
tree9530af2389ce4ce0dbb6c09d41b88245d99118e2 /src/java/com/jogamp/gluegen/JavaEmitter.java
parent150ea4f231c9629ef9ef354e3f1a92a516d46f91 (diff)
GlueGen JavaEmitter: Use proper class access modifiers for emitted classes incl. ProcAddressTable
Emitted Java classes as well as optional ProcAddressTable shall use unique generated access modifiers covering all MethodAccess cases.
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaEmitter.java')
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index f9dd13b..1ec1087 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -2311,6 +2311,23 @@ public class JavaEmitter implements GlueEmitter {
writer.println(" // ---- End CustomJavaCode .cfg declarations");
}
+ public String[] getClassAccessModifiers(final String classFQName) {
+ String[] accessModifiers;
+ final MethodAccess acc = cfg.accessControl(classFQName);
+ if( PUBLIC_ABSTRACT == acc ) {
+ accessModifiers = new String[] { PUBLIC.getJavaName(), PUBLIC_ABSTRACT.getJavaName() };
+ } else if( PACKAGE_PRIVATE == acc ) {
+ accessModifiers = new String[] { PACKAGE_PRIVATE.getJavaName() };
+ } else if( PRIVATE == acc ) {
+ throw new IllegalArgumentException("Class access "+classFQName+" cannot be private");
+ } else if( PROTECTED == acc ) {
+ accessModifiers = new String[] { PROTECTED.getJavaName() };
+ } else { // default PUBLIC
+ accessModifiers = new String[] { PUBLIC.getJavaName() };
+ }
+ return accessModifiers;
+ }
+
/**
* Write out any header information for the output files (class declaration
* and opening brace, import statements, etc).
@@ -2346,13 +2363,7 @@ public class JavaEmitter implements GlueEmitter {
}
};
- String[] accessModifiers = null;
- if(cfg.accessControl(cfg.className()) == PUBLIC_ABSTRACT) {
- accessModifiers = new String[] { "public", "abstract" };
- } else {
- accessModifiers = new String[] { "public" };
- }
-
+ final String[] accessModifiers = getClassAccessModifiers(cfg.className());
CodeGenUtils.emitJavaHeaders(
javaWriter,
cfg.packageName(),
@@ -2390,13 +2401,7 @@ public class JavaEmitter implements GlueEmitter {
interfaces[userSpecifiedInterfaces.size()] = cfg.className();
}
- String[] accessModifiers = null;
- if(cfg.accessControl(cfg.implClassName()) == PUBLIC_ABSTRACT) {
- accessModifiers = new String[] { "public", "abstract" };
- } else {
- accessModifiers = new String[] { "public" };
- }
-
+ final String[] accessModifiers = getClassAccessModifiers(cfg.implClassName());
CodeGenUtils.emitJavaHeaders(
javaImplWriter,
cfg.implPackageName(),