branch feature/3880-java8-api-scan updated (d5b55db -> f7de57a)
This is an automated email from the git hooks/post-receive script. New change to branch feature/3880-java8-api-scan in repository i18n. See http://git.nuiton.org/i18n.git from d5b55db fixes #3880: Use java 8 API to scan code fixes #3449: Fail to extract t( t( "string") ) new f7de57a refs #3880: Use java 8 API to scan code The 1 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 f7de57a4aa84cb6cdb86623fb2c01fd16f10fa4c Author: Eric Chatellier <chatellier@codelutin.com> Date: Fri Feb 19 16:18:02 2016 +0100 refs #3880: Use java 8 API to scan code Summary of changes: .../i18n/plugin/parser/impl/ParserGWTJavaMojo.java | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 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 feature/3880-java8-api-scan in repository i18n. See http://git.nuiton.org/i18n.git commit f7de57a4aa84cb6cdb86623fb2c01fd16f10fa4c Author: Eric Chatellier <chatellier@codelutin.com> Date: Fri Feb 19 16:18:02 2016 +0100 refs #3880: Use java 8 API to scan code --- .../i18n/plugin/parser/impl/ParserGWTJavaMojo.java | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java index c8cc546..7b86245 100644 --- a/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java +++ b/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java @@ -27,7 +27,6 @@ package org.nuiton.i18n.plugin.parser.impl; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.TokenStream; -import org.antlr.v4.runtime.tree.ParseTree; import org.apache.commons.io.IOUtils; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -42,6 +41,8 @@ import org.nuiton.i18n.plugin.parser.SourceEntry; import org.nuiton.i18n.plugin.parser.java.Java8BaseVisitor; import org.nuiton.i18n.plugin.parser.java.Java8Lexer; import org.nuiton.i18n.plugin.parser.java.Java8Parser; +import org.nuiton.i18n.plugin.parser.java.Java8Parser.SingleElementAnnotationContext; +import org.nuiton.i18n.plugin.parser.java.Java8Parser.TypeNameContext; import org.nuiton.io.FileUpdater; import org.nuiton.io.MirroredFileUpdater; import org.nuiton.io.SortedProperties; @@ -227,31 +228,30 @@ public class ParserGWTJavaMojo extends AbstractI18nParserMojo { annotationPrefix.add("LocalizableResource.Key"); annotationPrefix.add("com.google.gwt.i18n.client.LocalizableResource.Key"); } - + @Override - public Void visitAnnotation(Java8Parser.AnnotationContext ctx) { + public Void visitSingleElementAnnotation(SingleElementAnnotationContext ctx) { boolean match = false; - if (ctx.getChildCount() > 3) { - ParseTree child = ctx.getChild(1); - String childText = child.getText(); - if (annotationPrefix.contains(childText)) { - - // key is argument 1 of child 2 - String firstArgs = ctx.getChild(3).getText(); - if (firstArgs.matches("^\"[^\"]+\"$")) { - String key = firstArgs.substring(1).substring(0, firstArgs.length() - 2); - if (getLog().isDebugEnabled()) { - getLog().debug(file.getName() + " detected key = " + key); - } - ParserGWTJavaMojo.GWTJavaFileParser.this.registerKey(key); + + TypeNameContext typeName = ctx.typeName(); + String childText = typeName.getText(); + if (annotationPrefix.contains(childText)) { + // key is argument 1 of child 2 + String firstArgs = ctx.elementValue().getText(); + if (firstArgs.matches("^\"[^\"]+\"$")) { + String key = firstArgs.substring(1).substring(0, firstArgs.length() - 2); + if (getLog().isDebugEnabled()) { + getLog().debug(file.getName() + " detected key = " + key); } + ParserGWTJavaMojo.GWTJavaFileParser.this.registerKey(key); match = true; } } + Void aVoid = null; if (!match) { // continue visit - aVoid = super.visitAnnotation(ctx); + aVoid = super.visitSingleElementAnnotation(ctx); } return aVoid; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm