Match different output Java8 between Windows and Linux
authorrfscholte <rfscholte@apache.org>
Wed, 1 Aug 2018 18:42:59 +0000 (20:42 +0200)
committerrfscholte <rfscholte@apache.org>
Wed, 1 Aug 2018 18:42:59 +0000 (20:42 +0200)
src/main/java/org/apache/maven/plugins/jdeps/consumers/JDepsConsumer.java
src/test/java/org/apache/maven/plugins/jdeps/consumers/JDepsConsumerTest.java

index c193fa1..7d9df41 100644 (file)
@@ -39,10 +39,11 @@ public class JDepsConsumer
 {\r
 \r
     /**\r
-     * JDK8: JDK internal API (rt.jar)\r
-     * JDK9: JDK internal API (java.base)\r
+     * JDK8 Windows: JDK internal API (rt.jar)\r
+     * JDK8 Linux:   JDK internal API (JDK removed internal API)\r
+     * JDK9:         JDK internal API (java.base)\r
      */\r
-    private static final Pattern JDKINTERNALAPI = Pattern.compile( "\\s+->\\s([a-z\\.]+)\\s+(JDK internal API .+)" );\r
+    private static final Pattern JDKINTERNALAPI = Pattern.compile( ".+->\\s([a-z\\.]+)\\s+(JDK internal API .+)" );\r
 \r
     /**\r
      * <dl>\r
index ba32463..aafad5c 100644 (file)
@@ -42,6 +42,21 @@ public class JDepsConsumerTest
         assertEquals( "JDK internal API (java.base)", consumer.getOffendingPackages().get( "sun.misc" ) );\r
         assertEquals( 0, consumer.getProfiles().size() );\r
     }\r
+    \r
+    @Test\r
+    public void testJDKInternalAPI_Linux_Java8()\r
+    {\r
+        consumer = new JDepsConsumer();\r
+        consumer.consumeLine( "classes -> JDK removed internal API" );\r
+        consumer.consumeLine( "classes -> java.base" );\r
+        consumer.consumeLine( "   <unnamed>                                          -> java.io                                            java.base" );\r
+        consumer.consumeLine( "   <unnamed>                                          -> java.lang                                          java.base" );\r
+        consumer.consumeLine( "   <unnamed>                                          -> sun.misc                                           JDK internal API (JDK removed internal API)" );\r
+        \r
+        assertEquals( 1, consumer.getOffendingPackages().size() );\r
+        assertEquals( "JDK internal API (JDK removed internal API)", consumer.getOffendingPackages().get( "sun.misc" ) );\r
+        assertEquals( 0, consumer.getProfiles().size() );\r
+    }\r
 \r
     @Test\r
     public void testProfile()\r