Zhukov Maxim edited this page Jul 27, 2017 · 3 revisions

HOW DOES DP4J WORK?

dp4j analyses method blocks annotated with JUnit/TestNG @Test annotations and just before the compiler generates the bytecode for the tests it replaces every privileged access with the equivalent Java Reflection API calls (in the AST).

IS THE REFLECTION API THAT DIFFICULT?

Oracle describes common problems encountered using the Reflection API in troubleshooting sections of its tutorials: Fields, Methods, Constructors. Why bother?

HOW CAN I SEE THE GENERATED CODE BY DP4J?

You can view the injected code with the -Averbose=true option to your Javac compile parameters as shown below, and discussed in this stackoveflow answer:

javac -cp dp4j-1.0-jar-with-dependencies.jar -Averbose=true REPLACE-WITH-YOUR-JAVA-CLASS.java 

DOES IT WORK WITH JAVA 7?

Yes, Dp4j was developed against the Java 6 Compiler API to work with Java 5+ Projects. The demo project dp4jmaventest.zip has also been compiled and tested successfully using jdk1.7.0_51.

DOES IT WORK WITH ECLIPSE?

Only if you use the Standard Java Compiler (through Maven or otherwise). Eclipse use its own Java Compiler, while dp4j interacts with javac internal APIs. But if you use Maven/m2eclipse then you can specify to use the javac compiler. dp4jmaventest.zip demonstrates. IntelliJ uses Oracle's Java Compiler, just as NetBeans does.

HOW TO USE DP4J IN A MAVEN PROJECT?

Dp4j is build using Maven and is published directly to the Maven Central Repository so that you don't have to add any new Repository to you POM. Click here to download an example Maven project using Dp4j.

HOW TO USE DP4J IN AN IVY PROJECT?

Since Dp4j is published on the Central Repository, you can declare a dependency to it as shown on the repo. You may however also need to configure annotations processing in your build configuration, as done in the pom.xml of this Maven project.

HOW TO HELP?

Contributions extending syntax coverage and patterns validation are welcome and duly acknowledged in this open-source project. The quickest thing you can do is vote for this javac bug. For more visit the issues list and the Help Wanted jobs list. Oh, and if you don't find the time to code, donations will pay for it and we will all benefit from more features and fewer issues.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.