@@ -1735,7 +1735,7 @@ public boolean visit(MethodInvocation node) {
1735
1735
//if (args.size() == 1) {
1736
1736
Expression arg = (Expression ) args .get (args .size () - 1 );
1737
1737
ITypeBinding resolveTypeBinding = arg .resolveTypeBinding ();
1738
- if (resolveTypeBinding .isArray ()) {
1738
+ if (resolveTypeBinding != null && resolveTypeBinding .isArray ()) {
1739
1739
needBrackets = false ;
1740
1740
}
1741
1741
//}
@@ -2437,6 +2437,12 @@ public void endVisit(TypeDeclaration node) {
2437
2437
2438
2438
int staticCount = -1 ;
2439
2439
ReferenceASTVisitor refVisitor = new ReferenceASTVisitor ();
2440
+ /*
2441
+ * Fixing bug#2797539 : Incorrect instantiation of member before inner class declaration inside interface
2442
+ * http://sourceforge.net/tracker/?func=detail&aid=2797539&group_id=155436&atid=795800
2443
+ * Interface's inner classes declaration is not in the correct order. Fix it by move codes a few lines
2444
+ * ahead of member initialization.
2445
+ */
2440
2446
for (Iterator iter = bodyDeclarations .iterator (); iter .hasNext ();) {
2441
2447
ASTNode element = (ASTNode ) iter .next ();
2442
2448
if (element instanceof TypeDeclaration ) {
@@ -2447,6 +2453,19 @@ public void endVisit(TypeDeclaration node) {
2447
2453
*/
2448
2454
element .accept (this );
2449
2455
}
2456
+ }
2457
+ }
2458
+ // Interface's inner interfaces or classes
2459
+ buffer .append (laterBuffer );
2460
+
2461
+ for (Iterator iter = bodyDeclarations .iterator (); iter .hasNext ();) {
2462
+ ASTNode element = (ASTNode ) iter .next ();
2463
+ if (element instanceof TypeDeclaration ) {
2464
+ if (node .isInterface ()) {
2465
+ // the above codes have already dealt those inner classes inside interface
2466
+ // just ignore here
2467
+ continue ;
2468
+ }
2450
2469
} else if (element instanceof Initializer ) {
2451
2470
if (getJ2STag ((Initializer ) element , "@j2sIgnore" ) != null ) {
2452
2471
continue ;
@@ -2586,8 +2605,6 @@ public void endVisit(TypeDeclaration node) {
2586
2605
if (staticCount != -1 ) {
2587
2606
buffer .append (");\r \n " );
2588
2607
}
2589
- // Interface's inner interfaces or classes
2590
- buffer .append (laterBuffer );
2591
2608
2592
2609
String fieldsSerializables = prepareSimpleSerializable (node , bodyDeclarations );
2593
2610
if (fieldsSerializables .length () > 0 ) {
0 commit comments