branch develop updated (7316b23 -> 738b17c)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git from 7316b23 [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 0b0b6c5 Version 3.0 here we come\! new 704b88f refs #2645 upgrade jdk level in project new ba6ea6f fixes #2645: Update jdk level to 1.7 Merge branch 'feature/2645' into develop new a3fba0e refs #3667 can now skip method body parse new 55fe629 fixes #3667: Parser only that is necessary in java files Merge branch 'feature/3667' into develop new 67396a6 refs #3668 can now use diamond syntax in field declarations new 738b17c fixes #3668: Allow to use Diamond in java files Merge branch 'feature/3668' into develop The 7 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 738b17c2e3872c015730c53b202db156738b1f00 Merge: 55fe629 67396a6 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:58:29 2015 +0200 fixes #3668: Allow to use Diamond in java files Merge branch 'feature/3668' into develop commit 67396a686b2d4859a20ee66fe867be94cd9e8de5 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:58:25 2015 +0200 refs #3668 can now use diamond syntax in field declarations commit 55fe6298874ffa354568de8252eb1616d9997553 Merge: ba6ea6f a3fba0e Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:52:23 2015 +0200 fixes #3667: Parser only that is necessary in java files Merge branch 'feature/3667' into develop commit a3fba0e9c01dd6c71581393629dc7b5b12fd3349 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:49:32 2015 +0200 refs #3667 can now skip method body parse commit ba6ea6f11b77e4e4abc54e6ddcc771bd1c7a0edf Merge: 0b0b6c5 704b88f Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:51:27 2015 +0200 fixes #2645: Update jdk level to 1.7 Merge branch 'feature/2645' into develop commit 704b88fe17fd5ebc0530079c2e9dea5869094e2b Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:51:24 2015 +0200 refs #2645 upgrade jdk level in project commit 0b0b6c5518e0bf51d30692e67802a2930e936093 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 5 13:13:14 2015 +0200 Version 3.0 here we come\! Summary of changes: jaxx-application-api/pom.xml | 2 +- jaxx-application-swing/pom.xml | 2 +- jaxx-compiler/pom.xml | 2 +- .../java/jaxx/compiler/java/parser/JavaParser.java | 114 +++++++++++++++++++-- .../ClassDescriptorResolverFromJavaFile.java | 14 ++- .../jaxx/compiler/java/parser/JavaParserTest.java | 106 +++++++++++++++++++ jaxx-config/pom.xml | 2 +- jaxx-demo/pom.xml | 2 +- jaxx-maven-plugin/pom.xml | 2 +- jaxx-runtime/pom.xml | 2 +- jaxx-validator/pom.xml | 2 +- jaxx-widgets-common/pom.xml | 2 +- jaxx-widgets-datetime/pom.xml | 2 +- jaxx-widgets-extra/pom.xml | 2 +- jaxx-widgets-gis/pom.xml | 2 +- jaxx-widgets-number/pom.xml | 2 +- jaxx-widgets-select/pom.xml | 2 +- jaxx-widgets/pom.xml | 2 +- pom.xml | 11 +- 19 files changed, 249 insertions(+), 26 deletions(-) create mode 100644 jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 0b0b6c5518e0bf51d30692e67802a2930e936093 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 5 13:13:14 2015 +0200 Version 3.0 here we come\! --- jaxx-application-api/pom.xml | 2 +- jaxx-application-swing/pom.xml | 2 +- jaxx-compiler/pom.xml | 2 +- jaxx-config/pom.xml | 2 +- jaxx-demo/pom.xml | 2 +- jaxx-maven-plugin/pom.xml | 2 +- jaxx-runtime/pom.xml | 2 +- jaxx-validator/pom.xml | 2 +- jaxx-widgets-common/pom.xml | 2 +- jaxx-widgets-datetime/pom.xml | 2 +- jaxx-widgets-extra/pom.xml | 2 +- jaxx-widgets-gis/pom.xml | 2 +- jaxx-widgets-number/pom.xml | 2 +- jaxx-widgets-select/pom.xml | 2 +- jaxx-widgets/pom.xml | 2 +- pom.xml | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/jaxx-application-api/pom.xml b/jaxx-application-api/pom.xml index 5a1f068..3a92bec 100644 --- a/jaxx-application-api/pom.xml +++ b/jaxx-application-api/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-application-swing/pom.xml b/jaxx-application-swing/pom.xml index 1164166..5a86990 100644 --- a/jaxx-application-swing/pom.xml +++ b/jaxx-application-swing/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index c5d6c57..5169282 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-config/pom.xml b/jaxx-config/pom.xml index 2e5ef01..022e9ae 100644 --- a/jaxx-config/pom.xml +++ b/jaxx-config/pom.xml @@ -31,7 +31,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index e4b1927..cce50f1 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-maven-plugin/pom.xml b/jaxx-maven-plugin/pom.xml index ea0d3e8..409a0fe 100644 --- a/jaxx-maven-plugin/pom.xml +++ b/jaxx-maven-plugin/pom.xml @@ -31,7 +31,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-runtime/pom.xml b/jaxx-runtime/pom.xml index f75bb0b..85d49c4 100644 --- a/jaxx-runtime/pom.xml +++ b/jaxx-runtime/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-validator/pom.xml b/jaxx-validator/pom.xml index 540be52..26e325d 100644 --- a/jaxx-validator/pom.xml +++ b/jaxx-validator/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets-common/pom.xml b/jaxx-widgets-common/pom.xml index 182aae3..cb45845 100644 --- a/jaxx-widgets-common/pom.xml +++ b/jaxx-widgets-common/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets-datetime/pom.xml b/jaxx-widgets-datetime/pom.xml index d1c6159..73420d4 100644 --- a/jaxx-widgets-datetime/pom.xml +++ b/jaxx-widgets-datetime/pom.xml @@ -31,7 +31,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets-extra/pom.xml b/jaxx-widgets-extra/pom.xml index 3be9555..3e597ff 100644 --- a/jaxx-widgets-extra/pom.xml +++ b/jaxx-widgets-extra/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets-gis/pom.xml b/jaxx-widgets-gis/pom.xml index 019a358..0dfebf6 100644 --- a/jaxx-widgets-gis/pom.xml +++ b/jaxx-widgets-gis/pom.xml @@ -31,7 +31,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets-number/pom.xml b/jaxx-widgets-number/pom.xml index 26e4078..7889ee1 100644 --- a/jaxx-widgets-number/pom.xml +++ b/jaxx-widgets-number/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets-select/pom.xml b/jaxx-widgets-select/pom.xml index 84e303b..205f08e 100644 --- a/jaxx-widgets-select/pom.xml +++ b/jaxx-widgets-select/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets/pom.xml b/jaxx-widgets/pom.xml index 985783e..4f0f134 100644 --- a/jaxx-widgets/pom.xml +++ b/jaxx-widgets/pom.xml @@ -31,7 +31,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/pom.xml b/pom.xml index efe1b99..a3d669f 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ </parent> <artifactId>jaxx</artifactId> - <version>2.24-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> <modules> <module>jaxx-runtime</module> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 704b88fe17fd5ebc0530079c2e9dea5869094e2b Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:51:24 2015 +0200 refs #2645 upgrade jdk level in project --- pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pom.xml b/pom.xml index a3d669f..e207b82 100644 --- a/pom.xml +++ b/pom.xml @@ -131,6 +131,15 @@ <!-- pour un muli module on doit fixer le projectId --> <projectId>jaxx</projectId> + <!-- Java version --> + <javaVersion>1.7</javaVersion> + <!--TODO remove this when idea won't ask to change jdk level at each pom modification--> + <maven.compiler.source>${javaVersion}</maven.compiler.source> + <!--TODO remove this when idea won't ask to change jdk level at each pom modification--> + <maven.compiler.target>${javaVersion}</maven.compiler.target> + <signatureArtifactId>java17</signatureArtifactId> + <signatureVersion>1.0</signatureVersion> + <mavenVersion>2.2.1</mavenVersion> <nuitonValidatorVersion>3.0</nuitonValidatorVersion> <nuitonI18nVersion>3.3</nuitonI18nVersion> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit ba6ea6f11b77e4e4abc54e6ddcc771bd1c7a0edf Merge: 0b0b6c5 704b88f Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:51:27 2015 +0200 fixes #2645: Update jdk level to 1.7 Merge branch 'feature/2645' into develop pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit a3fba0e9c01dd6c71581393629dc7b5b12fd3349 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:49:32 2015 +0200 refs #3667 can now skip method body parse --- .../java/jaxx/compiler/java/parser/JavaParser.java | 56 +++++++++++-- .../ClassDescriptorResolverFromJavaFile.java | 14 +++- .../jaxx/compiler/java/parser/JavaParserTest.java | 98 ++++++++++++++++++++++ 3 files changed, 159 insertions(+), 9 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java index 4e7d5b0..6368eb6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java @@ -116,7 +116,11 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav } public JavaParser(String fileName) { - this(System.in); + this(fileName, false); + } + + public JavaParser(String fileName, boolean parseMethodBody) { + this(System.in, parseMethodBody); try { ReInit(new FileInputStream(new File(fileName))); } catch (Exception e) { @@ -143,11 +147,11 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav JavaParser parser; if (args.length == 0) { System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); - parser = new JavaParser(System.in); + parser = new JavaParser(System.in, true); } else if (args.length == 1) { System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); try { - parser = new JavaParser(new java.io.FileInputStream(args[0])); + parser = new JavaParser(new java.io.FileInputStream(args[0]), true); } catch (java.io.FileNotFoundException e) { System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); return; @@ -1687,7 +1691,30 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACE: - Block(); + + if (parseMethodBody) { + + Block(); + + } else { + + // We do not want to parse inside a method implementation, we just need to get method prototypes + // See https://forge.nuiton.org/issues/3667 + + int nbBlocks = 0; + do { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACE: + nbBlocks++; + break; + case RBRACE: + nbBlocks--; + break; + } + jj_consume_token(jj_ntk); + } while (nbBlocks > 0); + + } break; case SEMICOLON: jj_consume_token(SEMICOLON); @@ -9908,11 +9935,22 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav private boolean jj_semLA; + private final boolean parseMethodBody; + public JavaParser(java.io.InputStream stream) { - this(stream, null); + this(stream, null, false); + } + + public JavaParser(java.io.InputStream stream, boolean parseMethodBody) { + this(stream, null, parseMethodBody); } public JavaParser(java.io.InputStream stream, String encoding) { + this(stream, encoding, false); + } + + public JavaParser(java.io.InputStream stream, String encoding, boolean parseMethodBody) { + this.parseMethodBody = parseMethodBody; try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch (java.io.UnsupportedEncodingException e) { @@ -9940,6 +9978,11 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav } public JavaParser(java.io.Reader stream) { + this(stream, false); + } + + public JavaParser(java.io.Reader stream, boolean parseMethodBody) { + this.parseMethodBody=parseMethodBody; jj_input_stream = new JavaCharStream(stream, 1, 1); token_source = new JavaParserTokenManager(jj_input_stream); token = new Token(); @@ -9954,7 +9997,8 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav jjtree.reset(); } - public JavaParser(JavaParserTokenManager tm) { + public JavaParser(JavaParserTokenManager tm, boolean parseMethodBody) { + this.parseMethodBody =parseMethodBody; token_source = tm; token = new Token(); jj_ntk = -1; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java index c135a5e..250a618 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java @@ -61,8 +61,14 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver private static final Log log = LogFactory.getLog(ClassDescriptorResolverFromJavaFile.class); + private final boolean parseMethodBody; + public ClassDescriptorResolverFromJavaFile() { + this(false); + } + public ClassDescriptorResolverFromJavaFile(boolean parseMethodBody) { super(ClassDescriptorHelper.ResolverType.JAVA_FILE); + this.parseMethodBody = parseMethodBody; } @Override @@ -79,7 +85,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver if (log.isDebugEnabled()) { log.debug("for source " + displayName); } - JavaFileParser parser = new JavaFileParser(classLoader); + JavaFileParser parser = new JavaFileParser(classLoader, parseMethodBody); if (log.isDebugEnabled()) { log.debug("starting parsing : " + displayName); } @@ -206,6 +212,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver public static final String[] EMPTY_STRING_ARRAY = new String[0]; + private final boolean parseMethodBody; /** * To test if a compilation unit was already parsed. If so, then stop @@ -216,7 +223,8 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver */ private boolean firstTypeScanned; - protected JavaFileParser(ClassLoader classLoader) { + protected JavaFileParser(ClassLoader classLoader,boolean parseMethodBody) { + this.parseMethodBody = parseMethodBody; //FIXME-TC-20100504 : shoudl remove this to make the parser free of jaxx :) // We could imagine just to offers to the parser a list of namespaces // (for class resolving)... @@ -237,7 +245,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver firstTypeScanned = false; try { - JavaParser p = new JavaParser(src); + JavaParser p = new JavaParser(src, parseMethodBody); p.CompilationUnit(); SimpleNode node = p.popNode(); if (node != null) { diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java new file mode 100644 index 0000000..927e73f --- /dev/null +++ b/jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java @@ -0,0 +1,98 @@ +package jaxx.compiler.java.parser; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.reflect.resolvers.ClassDescriptorResolverFromJavaFile; +import org.junit.Assert; +import org.junit.Test; +import org.nuiton.util.FileUtil; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; + +/** + * Created on 4/12/15. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.24 + */ +public class JavaParserTest { + + @Test + public void testParseClassButNotMethodBody() throws IOException, ClassNotFoundException, NoSuchMethodException { + + File file = new File("").getAbsoluteFile(); + Path rootSourceDirectory = file.toPath().resolve("src").resolve("test").resolve("java"); + + File thisClassJavaFile = new File(FileUtil.getFileFromFQN(rootSourceDirectory.toFile(), getClass().getPackage().getName()), getClass().getSimpleName() + ".java"); + + Assert.assertTrue("Could not find java file " + thisClassJavaFile, thisClassJavaFile.exists()); + + ClassDescriptorResolverFromJavaFile resolver = new ClassDescriptorResolverFromJavaFile(); + + ClassDescriptor yo = resolver.resolvDescriptor("yo", thisClassJavaFile.toURI().toURL()); + MethodDescriptor[] methodDescriptors = yo.getMethodDescriptors(); + Assert.assertTrue(methodDescriptors.length>3); + + { + MethodDescriptor method = yo.getMethodDescriptor("testParseClassButNotMethodBody"); + Assert.assertNotNull(method); + } + + { + MethodDescriptor method = yo.getMethodDescriptor("methodWithDiamondInside"); + Assert.assertNotNull(method); + } + + { + MethodDescriptor method = yo.getMethodDescriptor("methodWithTryResourceInside"); + Assert.assertNotNull(method); + } + + } + + + @Test + public void testParseClassAndMethodBody() throws IOException, ClassNotFoundException, NoSuchMethodException { + + File file = new File("").getAbsoluteFile(); + Path rootSourceDirectory = file.toPath().resolve("src").resolve("test").resolve("java"); + + File thisClassJavaFile = new File(FileUtil.getFileFromFQN(rootSourceDirectory.toFile(), getClass().getPackage().getName()), getClass().getSimpleName() + ".java"); + + Assert.assertTrue("Could not find java file " + thisClassJavaFile, thisClassJavaFile.exists()); + + ClassDescriptorResolverFromJavaFile resolver = new ClassDescriptorResolverFromJavaFile(true); + + try { + resolver.resolvDescriptor("yo", thisClassJavaFile.toURI().toURL()); + Assert.fail("Can't compile body method (there is some jdk7 syntaxes inside them)..."); + } catch (RuntimeException e) { + Assert.assertTrue(e.getCause() instanceof CompilerException); + } + + } + + public void methodWithDiamondInside() { + + new ArrayList<>(); + + } + + public void methodWithTryResourceInside() throws IOException { + + try (BufferedReader reader = Files.newBufferedReader(new File("").toPath(), Charset.forName("UTF-8"))) { + + System.out.println(reader); + } + + + } + +} \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 55fe6298874ffa354568de8252eb1616d9997553 Merge: ba6ea6f a3fba0e Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:52:23 2015 +0200 fixes #3667: Parser only that is necessary in java files Merge branch 'feature/3667' into develop .../java/jaxx/compiler/java/parser/JavaParser.java | 56 +++++++++++-- .../ClassDescriptorResolverFromJavaFile.java | 14 +++- .../jaxx/compiler/java/parser/JavaParserTest.java | 98 ++++++++++++++++++++++ 3 files changed, 159 insertions(+), 9 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 67396a686b2d4859a20ee66fe867be94cd9e8de5 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:58:25 2015 +0200 refs #3668 can now use diamond syntax in field declarations --- .../java/jaxx/compiler/java/parser/JavaParser.java | 58 +++++++++++++++++++++- .../jaxx/compiler/java/parser/JavaParserTest.java | 12 ++++- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java index 6368eb6..4800ccd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java @@ -2392,6 +2392,62 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav } } + final public void TypeArgumentsForAllocation() throws ParseException { + /*@bgen(jjtree) TypeArguments */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LT); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case GT: + // Diamond expression (jdk7) + jj_consume_token(GT); + return; + } + TypeArgument(); + label_21: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_21; + } + jj_consume_token(COMMA); + TypeArgument(); + } + jj_consume_token(GT); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + final public void TypeArgument() throws ParseException { /*@bgen(jjtree) TypeArgument */ SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENT); @@ -4390,7 +4446,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav ClassOrInterfaceType(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: - TypeArguments(); + TypeArgumentsForAllocation(); break; default: ; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java index 927e73f..b82a862 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/java/parser/JavaParserTest.java @@ -15,6 +15,7 @@ import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; +import java.util.List; /** * Created on 4/12/15. @@ -24,6 +25,9 @@ import java.util.ArrayList; */ public class JavaParserTest { + public static final List<String> DUMMY_LIST = new ArrayList<>(); + public static final List<String> DUMMY_LIST2 = new ArrayList<String>(); + @Test public void testParseClassButNotMethodBody() throws IOException, ClassNotFoundException, NoSuchMethodException { @@ -81,15 +85,19 @@ public class JavaParserTest { public void methodWithDiamondInside() { - new ArrayList<>(); + System.out.println(new ArrayList<>()); + System.out.println(DUMMY_LIST); + System.out.println(DUMMY_LIST2); } - public void methodWithTryResourceInside() throws IOException { + public void methodWithTryResourceInside() { try (BufferedReader reader = Files.newBufferedReader(new File("").toPath(), Charset.forName("UTF-8"))) { System.out.println(reader); + } catch (IOException | RuntimeException e ) { + e.printStackTrace(); } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 738b17c2e3872c015730c53b202db156738b1f00 Merge: 55fe629 67396a6 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Apr 12 13:58:29 2015 +0200 fixes #3668: Allow to use Diamond in java files Merge branch 'feature/3668' into develop .../java/jaxx/compiler/java/parser/JavaParser.java | 58 +++++++++++++++++++++- .../jaxx/compiler/java/parser/JavaParserTest.java | 12 ++++- 2 files changed, 67 insertions(+), 3 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm