You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/07/24 15:00:46 UTC

[GitHub] [maven-jxr] slawekjaranowski commented on a diff in pull request #60: [JXR-170] NullPointerException while parsing Java 15 multi-line String source

slawekjaranowski commented on code in PR #60:
URL: https://github.com/apache/maven-jxr/pull/60#discussion_r928270393


##########
maven-jxr/src/test/java/org/apache/maven/jxr/pacman/JavaFileImplTest.java:
##########
@@ -46,4 +46,14 @@ public void testJXR_135_lotsOfNested() throws IOException
         assertEquals( "NotNested", classTypes.next().getName() );
     }
 
-}
\ No newline at end of file
+    @Test
+    public void testJXR_170_multiLineString() throws IOException
+    {
+        JavaFileImpl javaFile = new JavaFileImpl( Paths.get(
+                "src/test/resources/jxr170/org/apache/maven/jxr/pacman/ClassWithMultiLineString.java" ),
+                "UTF-8" );
+        assertEquals( 1, javaFile.getClassTypes().size() );
+        assertEquals( "ClassWithMultiLineString", javaFile.getClassTypes().get(0).getName() );
+        assertEquals( "[ImportType[name=java.lang.*]]", javaFile.getImportTypes().toString() );

Review Comment:
   if `getImportTypes` - return array / list pease check similarly like for `getClassTypes`



##########
maven-jxr/src/main/java/org/apache/maven/jxr/pacman/BaseType.java:
##########
@@ -19,15 +19,27 @@
  * under the License.
  */
 
+import java.util.Objects;
+
 /**
  * put your documentation comment here
  *
  * @author jvanzyl
  */
 public abstract class BaseType
 {
-    private String name = null;
+    private final String name;
 
+    /**
+     * Construct type and set its name.
+     *
+     * @param name type name
+     */
+    public BaseType( String name )
+    {
+        Objects.requireNonNull( name );
+        this.name = name;

Review Comment:
   ```
    this.name = Objects.requireNonNull( name );
   ```



##########
maven-jxr-plugin/src/it/JXR-143_nofork/pom.xml:
##########
@@ -44,6 +44,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
+        <version>3.1.0</version>

Review Comment:
   How connected with this change?



##########
maven-jxr/src/main/java/org/apache/maven/jxr/pacman/BaseType.java:
##########
@@ -36,22 +48,15 @@
      */
     public String getName()
     {
-        if ( name == null )
-        {
-            return "";
-        }
         return this.name;
     }
 
 
-    /**
-     * Set the name for this type
-     *
-     * @param name The new name value
-     */
-    public void setName( String name )
+    @Override
+    public String toString()
     {
-        this.name = name;
+        return getClass().getSimpleName() + "[name=" + name + "]";

Review Comment:
   where is used?
   
   format `[...]` can be misunderstood as array



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org