[Git][java-team/jboss-jdeparser2][upstream] New upstream version 2.0.3

Markus Koschany gitlab at salsa.debian.org
Thu Jul 18 15:32:47 BST 2019



Markus Koschany pushed to branch upstream at Debian Java Maintainers / jboss-jdeparser2


Commits:
6047e7ce by Markus Koschany at 2019-07-18T14:18:42Z
New upstream version 2.0.3
- - - - -


13 changed files:

- pom.xml
- src/main/java/org/jboss/jdeparser/BasicJBlock.java
- src/main/java/org/jboss/jdeparser/ElseJBlock.java
- src/main/java/org/jboss/jdeparser/EmptyJStatement.java
- src/main/java/org/jboss/jdeparser/FieldRefJExpr.java
- src/main/java/org/jboss/jdeparser/FormatPreferences.java
- src/main/java/org/jboss/jdeparser/ImplJIf.java
- src/main/java/org/jboss/jdeparser/ImplJSourceFile.java
- src/main/java/org/jboss/jdeparser/InstanceOfJExpr.java
- src/main/java/org/jboss/jdeparser/JBlock.java
- src/main/java/org/jboss/jdeparser/NameJExpr.java
- src/main/java/org/jboss/jdeparser/StaticRefJExpr.java
- src/test/java/org/jboss/jdeparser/SimpleExampleTestCase.java


Changes:

=====================================
pom.xml
=====================================
@@ -28,12 +28,12 @@
 
     <groupId>org.jboss.jdeparser</groupId>
     <artifactId>jdeparser</artifactId>
-    <version>2.0.2.Final</version>
+    <version>2.0.3.Final</version>
 
     <parent>
         <groupId>org.jboss</groupId>
         <artifactId>jboss-parent</artifactId>
-        <version>14</version>
+        <version>34</version>
     </parent>
 
     <dependencies>
@@ -44,20 +44,4 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <configuration>
-                    <doclet>net.gleamynode.apiviz.APIviz</doclet>
-                    <docletArtifact>
-                        <groupId>org.jboss.apiviz</groupId>
-                        <artifactId>apiviz</artifactId>
-                        <version>1.3.2.GA</version>
-                    </docletArtifact>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>


=====================================
src/main/java/org/jboss/jdeparser/BasicJBlock.java
=====================================
@@ -420,12 +420,13 @@ class BasicJBlock extends BasicJCommentable implements JBlock, BlockContent {
             }
             writer.write($PUNCT.BRACE.CLOSE);
         } else {
-            if (beforeBrace != null && content.size() == 1 && ! (content.get(0) instanceof EmptyJStatement)) {
-                writer.sp();
-            }
-            for (BlockContent statement : content) {
-                statement.write(writer);
-                writer.nl();
+            Iterator<BlockContent> iterator = content.iterator();
+            if (iterator.hasNext()) {
+                iterator.next().write(writer);
+                while (iterator.hasNext()) {
+                    writer.nl();
+                    iterator.next().write(writer);
+                }
             }
         }
     }


=====================================
src/main/java/org/jboss/jdeparser/ElseJBlock.java
=====================================
@@ -35,10 +35,9 @@ class ElseJBlock extends BasicJBlock {
         super(_if.getParent(), braces);
     }
 
-    public void write(final SourceFileWriter writer) throws IOException {
-        writeComments(writer);
+    void write(final SourceFileWriter writer, final FormatPreferences.Space beforeBrace, final Braces braces) throws IOException {
         writer.write(FormatPreferences.Space.BEFORE_KEYWORD_ELSE);
         writer.write($KW.ELSE);
-        super.write(writer, FormatPreferences.Space.BEFORE_BRACE_ELSE);
+        super.write(writer, beforeBrace, braces);
     }
 }


=====================================
src/main/java/org/jboss/jdeparser/EmptyJStatement.java
=====================================
@@ -30,6 +30,5 @@ class EmptyJStatement extends BasicJStatement implements BlockContent {
     public void write(final SourceFileWriter writer) throws IOException {
         writeComments(writer);
         writer.write($PUNCT.SEMI);
-        writer.nl();
     }
 }


=====================================
src/main/java/org/jboss/jdeparser/FieldRefJExpr.java
=====================================
@@ -39,7 +39,7 @@ class FieldRefJExpr extends AbstractJAssignableExpr {
     public void write(final SourceFileWriter writer) throws IOException {
         writer.write(expr);
         writer.write($PUNCT.DOT);
-        writer.writeEscaped(refName);
+        writer.writeEscapedWord(refName);
     }
 
     AbstractJExpr getExpr() {


=====================================
src/main/java/org/jboss/jdeparser/FormatPreferences.java
=====================================
@@ -515,8 +515,6 @@ public final class FormatPreferences {
 
     /**
      * The type of space to apply.
-     *
-     * @apiviz.exclude
      */
     public enum SpaceType {
         NONE,
@@ -526,8 +524,6 @@ public final class FormatPreferences {
 
     /**
      * The location or position of a space.
-     *
-     * @apiviz.exclude
      */
     public enum Space {
         // default for all parens
@@ -655,8 +651,6 @@ public final class FormatPreferences {
 
     /**
      * A category of indentation.
-     *
-     * @apiviz.exclude
      */
     public enum Indentation {
         MEMBERS_TOP_LEVEL,
@@ -681,8 +675,6 @@ public final class FormatPreferences {
 
     /**
      * Categories for wrapping rules.
-     *
-     * @apiviz.exclude
      */
     public enum Wrapping {
         EXCEPTION_LIST,
@@ -693,8 +685,6 @@ public final class FormatPreferences {
 
     /**
      * The wrapping mode.
-     *
-     * @apiviz.exclude
      */
     public enum WrappingMode {
         ALWAYS_WRAP,
@@ -707,13 +697,12 @@ public final class FormatPreferences {
 
     /**
      * Option flags.
-     *
-     * @apiviz.exclude
      */
     public enum Opt {
         ENUM_TRAILING_COMMA,
         ENUM_EMPTY_PARENS,
         COMPACT_INIT_ONLY_CLASS,
+        DROP_UNUSED_LABELS,
     }
 
 


=====================================
src/main/java/org/jboss/jdeparser/ImplJIf.java
=====================================
@@ -56,6 +56,9 @@ class ImplJIf extends ConditionJBlock implements JIf {
         writer.write(getCondition());
         writer.write(FormatPreferences.Space.WITHIN_PAREN_IF);
         writer.write($PUNCT.PAREN.CLOSE);
+        if (! hasSingleItemOfType(EmptyJStatement.class)) {
+            writer.sp();
+        }
         super.write(writer);
         if (_else != null) {
             if (hasSingleItemOfType(ImplJIf.class)) {


=====================================
src/main/java/org/jboss/jdeparser/ImplJSourceFile.java
=====================================
@@ -113,7 +113,7 @@ class ImplJSourceFile extends BasicJCommentable implements JSourceFile {
     }
 
     public JSourceFile _import(final JType type) {
-        if (! (type instanceof ReferenceJType) && ! (type instanceof NestedJType)) {
+        if (! (type instanceof ReferenceJType) && ! (type instanceof NestedJType) && ! (type instanceof NarrowedJType)) {
             // can't import this type
             return this;
         }
@@ -122,7 +122,7 @@ class ImplJSourceFile extends BasicJCommentable implements JSourceFile {
             return this;
         }
         checkPackage();
-        imports.put(type.simpleName(), (AbstractJType) type);
+        imports.put(type.simpleName(), (AbstractJType) type.erasure());
         return this;
     }
 


=====================================
src/main/java/org/jboss/jdeparser/InstanceOfJExpr.java
=====================================
@@ -45,6 +45,10 @@ class InstanceOfJExpr extends AbstractJExpr {
     }
 
     public void write(final SourceFileWriter writer) throws IOException {
+        final Token writerState = writer.getState();
+        if (writerState == $WORD || writerState == $NUMBER || writerState instanceof $KW) {
+            writer.sp();
+        }
         writer.write(expr);
         writer.write($KW.INSTANCEOF);
         writer.write(type);


=====================================
src/main/java/org/jboss/jdeparser/JBlock.java
=====================================
@@ -673,8 +673,6 @@ public interface JBlock extends JStatement, JCommentable {
 
     /**
      * Braces mode.
-     *
-     * @apiviz.exclude
      */
     enum Braces {
         /**


=====================================
src/main/java/org/jboss/jdeparser/NameJExpr.java
=====================================
@@ -33,6 +33,7 @@ class NameJExpr extends AbstractJAssignableExpr {
     }
 
     public void write(final SourceFileWriter writer) throws IOException {
-        writer.writeEscaped(name);
+        writer.addWordSpace();
+        writer.writeEscapedWord(name);
     }
 }


=====================================
src/main/java/org/jboss/jdeparser/StaticRefJExpr.java
=====================================
@@ -55,14 +55,14 @@ class StaticRefJExpr extends AbstractJAssignableExpr {
             type.writeDirect(writer);
             writer.write($PUNCT.DOT);
         }
-        writer.writeEscaped(refName);
+        writer.writeEscapedWord(refName);
     }
 
     void writeForImport(final SourceFileWriter writer) throws IOException {
         writer.processSpacing();
         writer.writeClass(type.qualifiedName());
         writer.write($PUNCT.DOT);
-        writer.writeEscaped(refName);
+        writer.writeEscapedWord(refName);
     }
 
     String getName() {


=====================================
src/test/java/org/jboss/jdeparser/SimpleExampleTestCase.java
=====================================
@@ -62,6 +62,13 @@ public class SimpleExampleTestCase extends AbstractGeneratingTestCase {
         JIf jIf = body._if(JExprs.$v(t).eq(JExpr.NULL));
         jIf.assign(JExprs.$v(t), str("new Value"));
         jIf._else().assign(JExprs.$v(t), str("other value"));
+        jIf = body._if(JExprs.$v(t).eq(JExpr.NULL));
+        jIf.assign(JExprs.$v(t), str("new Value"));
+        jIf = body._if(JExprs.$v(t).eq(JExpr.NULL));
+        jIf._else().assign(JExprs.$v(t), str("other value"));
+        jIf = body._if(JExprs.$v(t).eq(JExpr.NULL));
+        jIf.empty();
+        jIf._else().assign(JExprs.$v(t), str("other value"));
 
         // static import and reference
         body.call(JTypes.$t(Thread.State.class).$v("NEW"), "toString");



View it on GitLab: https://salsa.debian.org/java-team/jboss-jdeparser2/commit/6047e7ce9145e43d99528705a1aa0eb77682c6a3

-- 
View it on GitLab: https://salsa.debian.org/java-team/jboss-jdeparser2/commit/6047e7ce9145e43d99528705a1aa0eb77682c6a3
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20190718/02e3f6cb/attachment.html>


More information about the pkg-java-commits mailing list