[Git][java-team/qdox2][upstream] New upstream version 2.0.0

Markus Koschany gitlab at salsa.debian.org
Thu Dec 12 23:47:03 GMT 2019



Markus Koschany pushed to branch upstream at Debian Java Maintainers / qdox2


Commits:
3cdb75ee by Markus Koschany at 2019-12-12T23:23:27Z
New upstream version 2.0.0
- - - - -


9 changed files:

- .travis.yml
- pom.xml
- src/grammar/parser.y
- src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaClass.java
- src/site/templates/site.vm
- src/test/java/com/thoughtworks/qdox/ClassResolutionTest.java
- src/test/java/com/thoughtworks/qdox/GenericsTest.java
- src/test/java/com/thoughtworks/qdox/JavaProjectBuilderTest.java
- src/test/java/com/thoughtworks/qdox/parser/ParserTest.java


Changes:

=====================================
.travis.yml
=====================================
@@ -1,5 +1,5 @@
 language: java
 jdk:
-  - openjdk7
-  - oraclejdk8
+  - openjdk8
+  - openjdk11
 script: mvn clean verify


=====================================
pom.xml
=====================================
@@ -10,7 +10,7 @@
   <name>QDox</name>
   <groupId>com.thoughtworks.qdox</groupId>
   <artifactId>qdox</artifactId>
-  <version>2.0-M10</version>
+  <version>2.0.0</version>
 
   <url>https://github.com/paul-hammant/qdox</url>
   <description>
@@ -36,7 +36,7 @@
     <connection>scm:git:https://github.com/paul-hammant/qdox.git</connection>
     <developerConnection>scm:git:ssh://git@github.com/paul-hammant/qdox.git</developerConnection>
     <url>https://github.com/paul-hammant/qdox</url>
-    <tag>qdox-2.0-M10</tag>
+    <tag>qdox-2.0.0</tag>
   </scm>
 
   <developers>
@@ -139,12 +139,12 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>2.3.2</version>
+          <version>3.8.1</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.19.1</version>
+          <version>2.22.1</version>
           <configuration>
             <reuseForks>false</reuseForks>
           </configuration>
@@ -174,7 +174,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-site-plugin</artifactId>
-          <version>3.0</version>
+          <version>3.8.2</version>
           <configuration>
             <templateFile>${basedir}/src/site/templates/site.vm</templateFile>
           </configuration>
@@ -298,7 +298,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-failsafe-plugin</artifactId>
-        <version>2.19.1</version>
+        <version>2.22.1</version>
         <executions>
           <execution>
             <goals>
@@ -311,7 +311,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-invoker-plugin</artifactId>
-        <version>2.0.0</version>
+        <version>3.2.0</version>
         <configuration>
           <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
           <postBuildHookScript>verify</postBuildHookScript>
@@ -322,6 +322,10 @@
           </goals>
           <settingsFile>src/it/settings.xml</settingsFile>
           <debug>true</debug>
+          <properties>
+            <maven.compiler.source>8</maven.compiler.source>
+            <maven.compiler.target>8</maven.compiler.target>
+          </properties>
         </configuration>
         <executions>
           <execution>


=====================================
src/grammar/parser.y
=====================================
@@ -56,7 +56,7 @@ import java.util.Stack;
 %token <ival> PLUSPLUS MINUSMINUS
 %token <sval> SUPER
 %token <sval> EQUALS STAREQUALS SLASHEQUALS PERCENTEQUALS PLUSEQUALS MINUSEQUALS LESSTHAN2EQUALS GREATERTHAN2EQUALS GREATERTHAN3EQUALS AMPERSANDEQUALS CIRCUMFLEXEQUALS VERTLINEEQUALS
-%type <type> PrimitiveType ReferenceType ArrayType ClassOrInterfaceType
+%type <type> PrimitiveType ReferenceType ArrayType ClassOrInterfaceType TypeVariable
 %type <annoval> Expression Literal Annotation ElementValue ElementValueArrayInitializer
 %type <annoval> ConditionalExpression ConditionalOrExpression ConditionalAndExpression InclusiveOrExpression ExclusiveOrExpression AndExpression
 %type <annoval> EqualityExpression RelationalExpression ShiftExpression AdditiveExpression MultiplicativeExpression
@@ -1441,20 +1441,50 @@ Type: PrimitiveType
 //     ClassOrInterfaceType 
 //     TypeVariable 
 //     ArrayType
-ReferenceType: ArrayType
+ReferenceType: TypeVariable
+             | ArrayType
              | ClassOrInterfaceType
              ; 
 
+// Actually
 // ClassOrInterfaceType:
 //     ClassType 
 //     InterfaceType 
 // ClassType:
-//     {Annotation} Identifier [TypeArguments] 
-//     ClassOrInterfaceType . {Annotation} Identifier [TypeArguments] 
+//     {Annotation} TypeIdentifier [TypeArguments] 
+//     PackageName . {Annotation} TypeIdentifier [TypeArguments] 
+//     ClassOrInterfaceType . {Annotation} TypeIdentifier [TypeArguments] 
 // InterfaceType:
-//     ClassType 
+//     ClassType
+// Parser can't see the difference  
+ClassOrInterfaceType: QualifiedIdentifier /* =PackageName */ DOT Annotations_opt IDENTIFIER 
+                      {
+                        TypeDef td = new TypeDef($1 + '.' + $4,0);
+                        $$ = typeStack.push(td);
+                      }
+                      TypeArguments_opt
+                      {
+                        $$ = typeStack.pop();
+                      };
+                    |
+                      TypeDeclSpecifier 
+                      {
+                        TypeDef td = new TypeDef($1,0);
+                        $$ = typeStack.push(td);
+                      }
+                      TypeArguments_opt
+                      {
+                        $$ = typeStack.pop();
+                      };
+
+
 // TypeVariable:
-//     {Annotation} Identifier 
+//     {Annotation} Identifier
+TypeVariable: Annotations_opt QualifiedIdentifier
+              {
+                $$ = new TypeDef($2,0);
+              }
+            ;
 
 // ArrayType:
 //     PrimitiveType Dims 
@@ -1649,20 +1679,6 @@ PrimitiveType: BYTE
          ;
 
 // Actually
-// ClassOrInterfaceType: ClassType | InterfaceType;
-// ClassType:            TypeDeclSpecifier TypeArguments_opt
-// InterfaceType:        TypeDeclSpecifier TypeArguments_opt
-// Parser can't see the difference  
-ClassOrInterfaceType: TypeDeclSpecifier 
-                      {
-                        TypeDef td = new TypeDef($1,0);
-                        $$ = typeStack.push(td);
-                      }
-                      TypeArguments_opt
-                      {
-                        $$ = typeStack.pop();
-                      };
-// Actually
 // TypeDeclSpecifier: TypeName | ClassOrInterfaceType . Identifier
 // TypeName:          Identifier | TypeName . Identifier
 TypeDeclSpecifier: QualifiedIdentifier


=====================================
src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaClass.java
=====================================
@@ -143,6 +143,11 @@ public class DefaultJavaClass
     public JavaType getSuperClass()
     {
         JavaType result = null;
+
+        if(isPrimitive()) {
+            return null;
+        }
+
         JavaClass OBJECT_JAVACLASS = getJavaClassLibrary().getJavaClass( "java.lang.Object" );
         JavaClass ENUM_JAVACLASS = getJavaClassLibrary().getJavaClass( "java.lang.Enum" );
 


=====================================
src/site/templates/site.vm
=====================================
@@ -324,7 +324,7 @@
         ## Workaround for DOXIA-150 due to a non-desired behaviour in p-u
         ## @see org.codehaus.plexus.util.xml.Xpp3Dom#toString()
         ## @see org.codehaus.plexus.util.xml.Xpp3Dom#toUnescapedString()
-        #set ( $documentHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" )
+        #set ( $documentHeader = "<?xml version=""1.0"" encoding=""UTF-8""?>" )
         #set ( $documentHeader = $documentHeader.replaceAll( "\\", "" ) )
         #if ( $item.name == "script" )
           $StringUtils.replace( $item.toUnescapedString(), $documentHeader, "" )


=====================================
src/test/java/com/thoughtworks/qdox/ClassResolutionTest.java
=====================================
@@ -90,4 +90,14 @@ public class ClassResolutionTest
         assertEquals( "some.pack.Test.Inner.Inner2", parameter.getType().getFullyQualifiedName() );
         assertEquals( "some.pack.Test.Inner.Inner2", parameter.getFullyQualifiedName() );
     }
+
+    public void testIsAWithPrimitives()
+    {
+        JavaProjectBuilder builder = new JavaProjectBuilder();
+        String source = "class Foo { public byte[] bar() { return null; } }";
+        builder.addSource( new StringReader( source ) );
+        JavaMethod method = builder.getClassByName("Foo").getMethods().get(0);
+        JavaClass returns = method.getReturns();
+        assertFalse(returns.isA(builder.getClassByName("java.lang.Object")));
+    }
 }


=====================================
src/test/java/com/thoughtworks/qdox/GenericsTest.java
=====================================
@@ -3,8 +3,10 @@ package com.thoughtworks.qdox;
 import static org.mockito.Mockito.*;
 
 import java.io.StringReader;
+import java.util.Collection;
 import java.util.Collections;
 
+import com.thoughtworks.qdox.model.impl.DefaultJavaParameterizedType;
 import junit.framework.TestCase;
 
 import com.thoughtworks.qdox.model.JavaClass;
@@ -139,7 +141,27 @@ public class GenericsTest extends TestCase {
         builder.addSource(new StringReader(source));
         assertEquals("Bar", builder.getClassByName("Bar").getName());
     }
-    
+
+    public void testShouldUnderstandAnnotationsOnTypeParameters() {
+        String source = "import com.foo.Item;\n" +
+                "public class Bar {\n" +
+                "    public static Collection<Item> foo() { }\n" +
+                "    public static Collection<com.foo.Item> foo2() { }\n" +
+                "    public static Collection<@Annot Item> foo3() { }\n" +
+                "    public static Collection<@Annot com.foo.Item> foo4() { }\n" +
+                "    public static Collection<com.foo. at Annot Item> foo5() { }\n" +
+                "}";
+        builder.addSource(new StringReader(source));
+        JavaClass bar = builder.getClassByName("Bar");
+        assertEquals("Bar", bar.getName());
+
+        assertEquals(builder.getClassByName("com.foo.Item"), (( (DefaultJavaParameterizedType)bar.getMethods().get(0).getReturns()).getActualTypeArguments().get(0)));
+        assertEquals(builder.getClassByName("com.foo.Item"), (( (DefaultJavaParameterizedType)bar.getMethods().get(1).getReturns()).getActualTypeArguments().get(0)));
+        assertEquals(builder.getClassByName("com.foo.Item"), (( (DefaultJavaParameterizedType)bar.getMethods().get(2).getReturns()).getActualTypeArguments().get(0)));
+        assertEquals(builder.getClassByName("com.foo.Item"), (( (DefaultJavaParameterizedType)bar.getMethods().get(3).getReturns()).getActualTypeArguments().get(0)));
+        assertEquals(builder.getClassByName("com.foo.Item"), (( (DefaultJavaParameterizedType)bar.getMethods().get(4).getReturns()).getActualTypeArguments().get(0)));
+    }
+
     public void testGenericField() {
         // Also see QDOX-77
         String source = "" +


=====================================
src/test/java/com/thoughtworks/qdox/JavaProjectBuilderTest.java
=====================================
@@ -1639,8 +1639,6 @@ public class JavaProjectBuilderTest extends TestCase
             " SomeEnum(String string, int integer, String[] stringArray) {\n" + 
             " }\r\n" + 
             "}";
-        
-        builder.setDebugParser( true );
         builder.addSource( new StringReader( source ) ); 
     }
     
@@ -1766,8 +1764,6 @@ public class JavaProjectBuilderTest extends TestCase
                         "MyAnnoInterface{}\n" +
                         "interface NewLineInterface \n" +
                         "{}";
-//        builder.setDebugLexer( true );
-        builder.setDebugParser( true );
         JavaSource jSource = builder.addSource( new StringReader( source ) );
         assertEquals( 3, jSource.getClassByName( "MyClass" ).getLineNumber() );
         assertEquals( 5, jSource.getClassByName( "MyClass" ).getFieldByName( "CONSTANT1" ).getLineNumber() );


=====================================
src/test/java/com/thoughtworks/qdox/parser/ParserTest.java
=====================================
@@ -3055,7 +3055,6 @@ public class ParserTest extends TestCase {
         setupLex( 0 );
 
         Parser parser = new Parser( lexer, builder );
-        parser.setDebugParser( true );
         parser.parse();
 
         ArgumentCaptor<ClassDef> classCaptor = ArgumentCaptor.forClass( ClassDef.class );



View it on GitLab: https://salsa.debian.org/java-team/qdox2/commit/3cdb75ee76aeee29b32cfb8343dd8ad7ec194202

-- 
View it on GitLab: https://salsa.debian.org/java-team/qdox2/commit/3cdb75ee76aeee29b32cfb8343dd8ad7ec194202
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/20191212/6127119c/attachment.html>


More information about the pkg-java-commits mailing list