diff options
author | Sven Gothel <[email protected]> | 2015-03-06 07:28:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-06 07:28:35 +0100 |
commit | 8eb9e27bccca4a0cd6a0b1b15bee76576ce030c3 (patch) | |
tree | 27dc3f766a4c5085325fd6a019bd92b9c99f46ee /src/java/com/jogamp/gluegen/JavaEmitter.java | |
parent | ea6df88075c44f6b6317920119d6b33d5d97b362 (diff) |
Bug 1134 - Add ASTLocationTag, locating source of [semantic] errors while parsing / analyzing
New GlueGenException supports ASTLocationTag,
which will be throws in case of semantic and/or parsing errors.
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaEmitter.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 4db0482..17d51ab 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -144,9 +144,14 @@ public class JavaEmitter implements GlueEmitter { // Duplicate alias .. check and add aliased name sym.rename(newName); // only rename to allow 'equalSemantics' to not care .. if( !dupSym.equalSemantics(sym) ) { - throw new RuntimeException( - String.format("Duplicate Name (alias) w/ incompatible value:%n have '%s',%n this '%s'", - dupSym.getAliasedString(), sym.getAliasedString())); + final String message = + String.format("Duplicate Name (alias) w/ incompatible value:%n have '%s',%n this '%s'", + dupSym.getAliasedString(), sym.getAliasedString()); + if( sym instanceof ASTLocusTagProvider ) { + throw new GlueGenException(message, ((ASTLocusTagProvider)sym).getASTLocusTag()); + } else { + throw new GlueGenException(message); + } } dupSym.addAliasedName(origName); } else { @@ -160,9 +165,14 @@ public class JavaEmitter implements GlueEmitter { if( null != dupSym ) { // Duplicate orig .. check and drop if( !dupSym.equalSemantics(sym) ) { - throw new RuntimeException( + final String message = String.format("Duplicate Name (orig) w/ incompatible value:%n have '%s',%n this '%s'", - dupSym.getAliasedString(), sym.getAliasedString())); + dupSym.getAliasedString(), sym.getAliasedString()); + if( sym instanceof ASTLocusTagProvider ) { + throw new GlueGenException(message, ((ASTLocusTagProvider)sym).getASTLocusTag()); + } else { + throw new GlueGenException(message); + } } } else { // No duplicate orig .. add |