Skip to content

Commit

Permalink
* Forbid Parser from producing abstract classes, preventing C++ …
Browse files Browse the repository at this point in the history
…factory methods and such from working properly (issue #25)
  • Loading branch information
saudet committed Jul 31, 2015
1 parent c5c1622 commit 3b3b1c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Forbid `Parser` from producing `abstract` classes, preventing C++ factory methods and such from working properly ([issue #25](https://github.com/bytedeco/javacpp/issues/25))
* Fix crash when trying to create objects from abstract classes, to let the exception be thrown on return ([issue #26](https://github.com/bytedeco/javacpp/issues/26))
* Switch to GCC 4.9 by default on Android, probably dropping support for Android 2.2, because GCC 4.6 has been dropped from the NDK since r10e
* Insure `Generator` casts properly to `jweak` when calling `DeleteWeakGlobalRef()` ([issue #23](https://github.com/bytedeco/javacpp/issues/23))
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1296,8 +1296,7 @@ boolean function(Context context, DeclarationList declList) throws ParserExcepti

// add @Virtual annotation on user request only, inherited through context
if (type.virtual && context.virtualize) {
modifiers = context.inaccessible ? "@Virtual protected " : "@Virtual public ";
modifiers += decl.abstractMember ? "abstract " : "native ";
modifiers = context.inaccessible ? "@Virtual protected native " : "@Virtual public native ";
}

// compose the text of the declaration with the info we got up until this point
Expand Down Expand Up @@ -1918,7 +1917,7 @@ boolean group(Context context, DeclarationList declList) throws ParserException
ctx.variable = var;
declarations(ctx, declList2);
}
String modifiers = info.purify && ctx.virtualize ? "public static abstract " : "public static ";
String modifiers = "public static ";
boolean implicitConstructor = true, defaultConstructor = false, intConstructor = false,
pointerConstructor = false, abstractClass = info.purify && !ctx.virtualize, havePureConst = false, haveVariables = false;
for (Declaration d : declList2) {
Expand All @@ -1933,9 +1932,6 @@ boolean group(Context context, DeclarationList declList) throws ParserException
havePureConst |= d.constMember && d.abstractMember;
haveVariables |= d.variable;
}
if (abstractClass && ctx.virtualize) {
modifiers = "public static abstract ";
}
if (havePureConst && ctx.virtualize) {
modifiers = "@Const " + modifiers;
}
Expand Down

0 comments on commit 3b3b1c8

Please sign in to comment.