Community
Participate
Working Groups
Build ID: 3.4M2 I have a problem with ASTParser.createBinding returns IBinding[]{null} for the field javax.swing.BoxLayout.LINE_AXIS. It works fine for the other fields of this class. Bug? I use the following code: ASTParser p = ASTParser.newParser(AST.JLS3); p.setProject(resolvedField.getJavaProject()); IBinding[] createBindings= p.createBindings(new IJavaElement[]{resolvedField}, monitor); Wrong result for int LINE_AXIS [in BoxLayout [in BoxLayout.class [in javax.swing [in C:\Program Files\Java\jdk1.6.0_02\jre\lib\rt.jar]]]] Good result for int PAGE_AXIS [in BoxLayout [in BoxLayout.class [in javax.swing [in C:\Program Files\Java\jdk1.6.0_02\jre\lib\rt.jar]]]]
I'll investigate.
The problem comes from the fact that the binding key parser tries to parse the key of the binary field as a resolved key. It expects to find the return type before the field name. Since the name starts with a 'L', it considers the key to be a malformed key. Jérôme, I'll add a regression test for it (disabled for now). I'll attach a patch to be reviewed.
Created attachment 80053 [details] Proposed fix Regression tests are coming next. Jérôme, please review it. Looking at the code it looks like the first letter of each base type was covered by a check that is not done in the case of 'L'. I simply added the same check there. Now this case passes as well as all existing tests in the ASTModelBridgeTests.
Created attachment 80056 [details] Regression tests Two regression tests. One for PAGE_AXIS field and one for LINE_AXIS field. The first one should also pass without the fix, but the second would fail.
Created attachment 80074 [details] New regression tests I changed the regression tests to include a test that is using a field name starting with 'T'. This covers the two cases for the patch.
Created attachment 80430 [details] Simplified tests Same tests but simplified (only 1 assert per test) and with more comments.
Created attachment 80562 [details] Tests that don't depend on jclMin15.jar content
Fix and tests released for 3.4M3
Fix and tests released for 3.3.2
Verified for 3.4M3 using I20071029-0010 build.
Returning null can lead to NullPointerExceptions. This fix needs to be included in 3.3.2. Philippe please approve.
+1 for 3.3.2
Verified for 3.3.2 using M20080123-0800 build