This commit is contained in:
Julian Dolby 2017-03-14 10:05:18 -04:00
parent bb0f38338e
commit 7e3066b6cd
4 changed files with 34 additions and 5 deletions

View File

@ -167,7 +167,7 @@
<param name="destdir" value="${temp.folder}/dalvik/@dot"/>
<param name="jsv" value="1.6"/>
<param name="jtv" value="1.6"/>
<param name="excludes" value="**/bak/,**/SortingExample.java,defaultMethods/*.java,special/A.java,annotations/TypeAnnotatedClass*.java, annotations/TypeAnnotationTypeUse.java"/>
<param name="excludes" value="**/bak/,**/SortingExample.java,defaultMethods/*.java,special/A.java,bug144/A.java,annotations/TypeAnnotatedClass*.java, annotations/TypeAnnotationTypeUse.java"/>
</antcall>
</target>

View File

@ -0,0 +1,18 @@
package bug144;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
class A {
void m() {
Set<Object> set = new HashSet<>();
Stream<Object> stream = set.parallelStream();
stream.sorted();
stream.collect(Collectors.toList()); // this call forces the error.
}
public static void main(String[] args) {
new A().m();
}
}

View File

@ -41,7 +41,17 @@ import com.ibm.wala.util.strings.Atom;
*/
public class LambdaTest extends WalaTestCase {
@Test public void testStreamExample_137() throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException {
@Test public void testBug144() throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
"Lbug144/A");
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
}
@Test public void testBug137() throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,

View File

@ -276,13 +276,14 @@ public class LambdaSummaryClass extends SyntheticClass {
for(int i = isNew? 1: 0; i < invoke.getNumberOfParameters(); i++) {
params[i] = args + i + 1;
}
for(int n = 2, i = invoke.getNumberOfParameters(); i < numParams; i++) {
int n = 2;
for(int i = invoke.getNumberOfParameters(); i < numParams; i++) {
params[i] = n++;
}
if (isNew) {
v++;
summary.addStatement(insts.NewInstruction(inst++, new_v=v++, NewSiteReference.make(inst, callee.getDeclaringClass())));
//v++;
summary.addStatement(insts.NewInstruction(inst++, new_v=n++, NewSiteReference.make(inst, callee.getDeclaringClass())));
params[0] = new_v;
}