New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline instrumentation should not damage module-info #634

Merged
merged 2 commits into from Dec 28, 2017

Conversation

2 participants
@Godin
Member

Godin commented Dec 26, 2017

Given

$ mkdir -p src/org/example

$ cat <<END > src/module-info.java
module org.example {
}
END

$ cat <<END > src/org/example/HelloWorld.java
package org.example;

class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World");
  }
}
END

$ javac -d mods/org.example \
        src/module-info.java \
        src/org/example/HelloWorld.java

after #600 we are able to instrument module-info.class

$ java -jar jacococli.jar \
       instrument mods \
       --dest mods-instrumented

and after #565 execute instrumented module using --add-reads

$ java \
       --module-path mods-instrumented:jacocoagent.jar \
       --add-modules org.jacoco.agent.rt \
       --add-reads org.example=org.jacoco.agent.rt \
       --module org.example/org.example.HelloWorld

however test #608 lacks such execution and following exception went unnoticed

Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: mods-instrumented/org.example
Caused by: java.lang.module.InvalidModuleDescriptorException: Bad #fields

cause of exception

$ javap -p mods-instrumented/org.example/module-info.class
Compiled from "module-info.java"
module org.example {
  requires java.base;
  private static transient boolean[] $jacocoData;
  private static boolean[] $jacocoInit();
}

@Godin Godin self-assigned this Dec 23, 2017

@Godin Godin added this to TODO in Java 9 Dec 23, 2017

Godin added some commits Dec 26, 2017

Fix
@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Dec 26, 2017

Member

@marchof could you please review? If all fine, I'll squash and merge.

Member

Godin commented Dec 26, 2017

@marchof could you please review? If all fine, I'll squash and merge.

@Godin Godin requested a review from marchof Dec 26, 2017

@marchof

Thx!

@Godin Godin added this to the 0.8.0 milestone Dec 28, 2017

@Godin Godin moved this from TODO to DONE in Java 9 Dec 28, 2017

@Godin Godin merged commit 7f7c246 into master Dec 28, 2017

4 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@Godin Godin deleted the issue-634 branch Dec 28, 2017

@jacoco jacoco locked as resolved and limited conversation to collaborators Jan 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.