ponder-lab / Optimize-Java-8-Streams-Refactoring

Refactorings for optimizing Java 8 stream client code for greater parallelism and efficiency.
http://cuny.is/streams
Eclipse Public License 1.0
8 stars 7 forks source link

Empty typestate result when running automated refactoring tests #83

Closed khatchad closed 7 years ago

khatchad commented 7 years ago

In com.ibm.safe.typestate.core.AbstractTypestateSolver.computeTrackedInstancesByType(), the instanceType being tracked when running testBitSet manually is <Primordial,Ljava/util/stream/IntPipeline$Head>.

khatchad commented 7 years ago

auto.log manual.log

khatchad commented 7 years ago

That's a big difference.

khatchad commented 7 years ago

That's coming from com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis.getInstanceKeys().

khatchad commented 7 years ago

When running manually, the IJavaProject looks like this:

streammotivatingexample
  src
    <default> (...)
    in (...)
  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar (not open)
  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar
    <default> (not open)
    org.w3c.dom.xpath (not open)
    com.sun.istack (not open)
    com.sun.org.apache.xerces.internal.jaxp.datatype (not open)
    org.omg.stub.java.rmi (not open)
    com.sun.xml.internal.fastinfoset.stax.events (not open)
...

When running the test, it looks like this:

TestProject1508182244404
  /Users/raffi/.p2/pool/plugins/org.eclipse.jdt.ui.tests_3.12.2.v20160929-1056/testresources/rtstubs18.jar (not open)
  src
    <default> (not open)
    p (...)
khatchad commented 7 years ago

The problem can be summarized as follows. The type that needs to be found is <Primordial,Ljava/util/stream/IntPipeline$Head>. manual.log has it but auto.log does not.

khatchad commented 7 years ago

When I expand rtstubs18.jar, I see java/util/stream/IntPipeline.class.

khatchad commented 7 years ago

Analysis scope during manual evaluation:

scope   JavaSourceAnalysisScope  (id=1684)
Primordial
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/localedata.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunec.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/nashorn.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/cldrdata.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jaccess.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/icedtea-sound.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunjce_provider.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/zipfs.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunpkcs11.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/dnsns.jar
Extension
Application
 com.ibm.wala.classLoader.BinaryDirectoryTreeModule:/home/rk1424/Workspaces/Research/StreamMotivatingExample/bin
Source
Synthetic
Exclusions: null

And during automated testing:

scope   JavaSourceAnalysisScope  (id=202)   
Primordial
 JarFileModule:/Users/raffi/.p2/pool/plugins/org.eclipse.jdt.ui.tests_3.12.2.v20160929-1056/testresources/rtstubs18.jar
Extension
Application
 com.ibm.wala.classLoader.BinaryDirectoryTreeModule:/home/rk1424/Workspaces/junit-workspace/TestProject1508254654323/bin
Source
Synthetic
Exclusions: null
khatchad commented 7 years ago

Got the testing one to look like this:

scope   JavaSourceAnalysisScope  (id=181)   
Primordial
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/localedata.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunec.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/nashorn.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/cldrdata.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jaccess.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/icedtea-sound.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunjce_provider.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/zipfs.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunpkcs11.jar
 JarFileModule:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/dnsns.jar
Extension
Application
 com.ibm.wala.classLoader.BinaryDirectoryTreeModule:/home/rk1424/Workspaces/junit-workspace/TestProject1508256866867/bin
Source
Synthetic
Exclusions: null
khatchad commented 7 years ago
$ find /home/rk1424/Workspaces/Research/StreamMotivatingExample/bin
/home/rk1424/Workspaces/Research/StreamMotivatingExample/bin
/home/rk1424/Workspaces/Research/StreamMotivatingExample/bin/in
/home/rk1424/Workspaces/Research/StreamMotivatingExample/bin/in/PaperExample1.class
/home/rk1424/Workspaces/Research/StreamMotivatingExample/bin/in/Widget.class
/home/rk1424/Workspaces/Research/StreamMotivatingExample/bin/in/Widget$Color.class

$ find /home/rk1424/Workspaces/junit-workspace/TestProject1508256866867/bin
/home/rk1424/Workspaces/junit-workspace/TestProject1508256866867/bin
/home/rk1424/Workspaces/junit-workspace/TestProject1508256866867/bin/p
/home/rk1424/Workspaces/junit-workspace/TestProject1508256866867/bin/p/A.class
khatchad commented 7 years ago

It works now.