2 Replies Latest reply on Oct 18, 2012 3:46 AM by athalay

    Is it possible to override the default JavaParserImpl.java in a plugin?

    athalay Newbie



      I want to set the supertype of a java class to a ParameterizedType, but the default implementation only supports SimpleType.

      I want to create a plugin and use MyJavaClassImpl wich inherits from the original and supports generics.

      How can i do this?


      I tried to set a dependency to the original java api implementation, but i got the following warning :

      "***WARNING*** Plugin has a dependency on internal Forge API [org.jboss.forge:forge-parser-java:jar::1.1.1.Final] - this is not allowed and may cause failures."


      My implementation of JavaParserProvider inherits from JavaParserImpl and overrides the "public JavaSource parse(final String data)" function to return a MyJavaClassImpl instead of JavaClassImp.

      When i try to create a new instance of MyJavaParserImp i got the following exception :


      java.lang.ClassNotFoundException: org.eclipse.jdt.core.dom.ASTVisitor from [Module "com.wcs.forge.persistence.wcsplugins:1.0.0-SNAPSHOT-da286062-16ed-4245-aabf-d2e0b1ead9ae" from local module loader @40f6dcc7 (roots: /home/athalay/apps/forge/modules,/home/athalay/.forge/plugins,/home/athalay/apps/forge)]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)


      Is there any way to override it from a plugin or i have to change the implementation in the forge source itself?