Skip to content

Commit 088ac62

Browse files
Debug Changes, Changed version of jdt-core for Java 8 Support,
Added new JDT-core 3.10.jar file and continued work on debugging to get transformer to work with symbolic ints
1 parent a328278 commit 088ac62

File tree

49 files changed

+6685
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+6685
-20
lines changed

.classpath

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
4+
<classpathentry kind="src" path="benchmarks/caseyjames/myJavaProjects/myJavaProjects-master/Assignments/src"/>
5+
<classpathentry kind="src" path="benchmarks/Jarcionek/MTG-Deck-Builder/MTG-Deck-Builder-master/src/main/java"/>
6+
<classpathentry kind="src" path="benchmarks/jipson7/sortingComparison-ScalaVsJava/sortingComparison-master/java"/>
7+
<classpathentry kind="src" path="benchmarks/JsonHunt/mobile-app-scaffolding/mobile-app-scaffolding-master/mobile/platforms/android/CordovaLib/src"/>
8+
<classpathentry kind="src" path="benchmarks/mathewreny/ARM230Compiler/ARM230Compiler-master/Build415/Program_Files"/>
9+
<classpathentry kind="src" path="benchmarks/mathewreny/ARM230Compiler/ARM230Compiler-master/BuildApril14th/Program_Files"/>
10+
<classpathentry kind="src" path="benchmarks/mathewreny/ARM230Compiler/ARM230Compiler-master/CSCELAB/ARM230Assembler/ARM230Assembler/Program_Files"/>
11+
<classpathentry kind="src" path="benchmarks/mathewreny/ARM230Compiler/ARM230Compiler-master/MostRecentEclipseBuild/Program_Files"/>
12+
<classpathentry kind="src" path="benchmarks/mathewreny/ARM230Compiler/ARM230Compiler-master/Program_Files"/>
13+
<classpathentry kind="src" path="benchmarks/PIfagor/Checkers/Checkers-master/src"/>
14+
<classpathentry kind="src" path="benchmarks/PunchApp/volley/volley-master/src"/>
15+
<classpathentry kind="src" path="benchmarks/ronak1790/Contested_Massive_Multiplayer_Online_Role_Playing_Game/Contested_Massive_Multiplayer_Online_Role_Playing_Game-master/Contested_Server-master/Contested_Server-master/ContestedServer"/>
16+
<classpathentry kind="src" path="benchmarks/stefanil/JFXControls/JFXControls-master/src/main/java"/>
17+
<classpathentry kind="src" path="benchmarks/The-WUUSTER/Randoms/Randoms-master/src"/>
18+
<classpathentry kind="src" path="benchmarks/wangjia55/CircleChooseDisc/CircleChooseDisc-master/app/src/main/java"/>
19+
<classpathentry kind="src" path="database/caseyjames/myJavaProjects/myJavaProjects-master/Assignments/src"/>
20+
<classpathentry kind="src" path="database/caseyjames/myJavaProjects/myJavaProjects-master/Labs/src"/>
21+
<classpathentry kind="src" path="database/jakubrojcek/GPR/GPR-master/src"/>
22+
<classpathentry kind="src" path="database/jakubrojcek/GPR/GPR-master/tests"/>
23+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/accumulo/src/main/java"/>
24+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/cassandra/src/main/java"/>
25+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/core/src/main/java"/>
26+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/core/src/test/java"/>
27+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/dynamodb/src/main/java"/>
28+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/elasticsearch/src/main/java"/>
29+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/elasticsearch/src/test/java"/>
30+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/gemfire/src/main/java"/>
31+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/hbase/src/main/java"/>
32+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/hypertable/src/main/java"/>
33+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/infinispan/src/main/java"/>
34+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/jdbc/src/main/java"/>
35+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/mapkeeper/src/main/java"/>
36+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/mongodb/src/main/java"/>
37+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/nosqldb/src/main/java"/>
38+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/orientdb/src/main/java"/>
39+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/redis/src/main/java"/>
40+
<classpathentry kind="src" path="database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/voldemort/src/main/java"/>
41+
<classpathentry kind="src" path="database/yue31313/ShellCommand/ShellCommand-master/gen"/>
42+
<classpathentry kind="src" path="database/yue31313/ShellCommand/ShellCommand-master/src"/>
43+
<classpathentry kind="src" path="programs"/>
44+
<classpathentry excluding="java/" kind="src" path="src"/>
45+
<classpathentry kind="src" path="src/java"/>
46+
<classpathentry kind="src" path="test"/>
47+
<classpathentry kind="src" path="suitablePrgms/moloneycharles"/>
48+
<classpathentry exported="true" kind="lib" path="lib/bcel-6.2.jar"/>
49+
<classpathentry exported="true" kind="lib" path="lib/commons-csv-1.5.jar"/>
50+
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.16.1.jar"/>
51+
<classpathentry exported="true" kind="lib" path="lib/jpf.jar"/>
52+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.core.contenttype-3.4.200-v20140207-1251.jar"/>
53+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.core.jobs-3.6.0-v20140424-0053.jar"/>
54+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.core.resources-3.6.0.v20100526-0737.jar"/>
55+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.core.runtime-3.7.0.jar"/>
56+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.equinox.common-3.6.0.v20100503.jar"/>
57+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.equinox.preferences-3.5.200-v20140224-1527.jar"/>
58+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.jdt.core-3.10.0.jar"/>
59+
<classpathentry kind="lib" path="lib/org.eclipse.jdt.core-3.3.0-v_771.jar"/>
60+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.jdt.ui-6.12.2.jar"/>
61+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.jface.jar"/>
62+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.ltk.core.refactoring-6.12.2.jar"/>
63+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.osgi-3.7.1.jar"/>
64+
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.text_3.5.0.jar"/>
65+
<classpathentry exported="true" kind="lib" path="lib/sootclasses-trunk-jar-with-dependencies.jar"/>
66+
<classpathentry exported="true" kind="src" path="/jpf-symbc"/>
67+
<classpathentry kind="output" path="bin"/>
68+
</classpath>

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>paclab-transformer</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

config.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ minLoc=100
55
downloadDir=database
66
benchmarkDir=benchmarks
77
debugLevel=2
8-
type=I
8+
type=R
99
minExpr=1
1010
minIfStmt=1
1111
minParams=0

database/Sonnbc/modelCheckingNobi/modelCheckingNobi-master/YCSB/pom.xml

+33
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,38 @@
110110
</executions>
111111
</plugin>
112112
</plugins>
113+
<pluginManagement>
114+
<plugins>
115+
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
116+
<plugin>
117+
<groupId>org.eclipse.m2e</groupId>
118+
<artifactId>lifecycle-mapping</artifactId>
119+
<version>1.0.0</version>
120+
<configuration>
121+
<lifecycleMappingMetadata>
122+
<pluginExecutions>
123+
<pluginExecution>
124+
<pluginExecutionFilter>
125+
<groupId>
126+
org.apache.maven.plugins
127+
</groupId>
128+
<artifactId>
129+
maven-checkstyle-plugin
130+
</artifactId>
131+
<versionRange>[2.6,)</versionRange>
132+
<goals>
133+
<goal>checkstyle</goal>
134+
</goals>
135+
</pluginExecutionFilter>
136+
<action>
137+
<ignore></ignore>
138+
</action>
139+
</pluginExecution>
140+
</pluginExecutions>
141+
</lifecycleMappingMetadata>
142+
</configuration>
143+
</plugin>
144+
</plugins>
145+
</pluginManagement>
113146
</build>
114147
</project>
-3.93 MB
Binary file not shown.

src/java/transform/Main.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public static void main(String[] args) throws IOException {
4444
File tmpDir = Files.createTempDirectory("paclab-transform").toFile();
4545
buildDir = new File(tmpDir, "bin");
4646

47-
String source = "suitablePrgms";
48-
String dest = "benchmarks";
47+
String source = "suitablePrgms/moloneycharles";
48+
String dest = "testOutput";
4949

5050
if (args.length == 2) {
5151
source = args[0];

src/java/transform/Transformer.java

+16-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
import java.util.Map.Entry;
1010

1111
import org.apache.commons.io.FileUtils;
12+
import org.eclipse.core.resources.IProject;
13+
import org.eclipse.core.resources.ResourcesPlugin;
14+
import org.eclipse.core.runtime.CoreException;
15+
import org.eclipse.jdt.core.IJavaProject;
16+
import org.eclipse.jdt.core.JavaCore;
1217
import org.eclipse.jdt.core.dom.AST;
1318
import org.eclipse.jdt.core.dom.ASTNode;
1419
import org.eclipse.jdt.core.dom.ASTParser;
@@ -81,7 +86,7 @@ public void annotateFiles() {
8186

8287
try {
8388
String source = new String(Files.readAllBytes(file.toPath()));
84-
ASTParser parser = ASTParser.newParser(AST.JLS3);
89+
ASTParser parser = ASTParser.newParser(AST.JLS8);
8590
parser.setSource(source.toCharArray());
8691
parser.setKind(ASTParser.K_COMPILATION_UNIT);
8792

@@ -125,12 +130,15 @@ public void transformFiles(int minTypeExpr, int minTypeCond, int minTypeParams,
125130
while (itr.hasNext()) {
126131

127132
File file = (File) itr.next();
133+
System.out.println("Current file name: " + file.getName());
128134

129135
try {
130136
String source = new String(Files.readAllBytes(file.toPath()));
131-
ASTParser parser = ASTParser.newParser(AST.JLS3);
137+
ASTParser parser = ASTParser.newParser(AST.JLS8);
132138
parser.setSource(source.toCharArray());
133139
parser.setKind(ASTParser.K_COMPILATION_UNIT);
140+
parser.setResolveBindings(true);
141+
parser.setBindingsRecovery(true);
134142

135143
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
136144
AST ast = cu.getAST();
@@ -189,9 +197,11 @@ public void transformFiles(int minTypeExpr, int minTypeCond, int minTypeParams,
189197

190198
//edits.
191199
String editedSource = document.get();
192-
ASTParser parserR = ASTParser.newParser(AST.JLS3);
200+
ASTParser parserR = ASTParser.newParser(AST.JLS8);
193201
parserR.setSource(editedSource.toCharArray());
194202
parserR.setKind(ASTParser.K_COMPILATION_UNIT);
203+
parserR.setResolveBindings(true);
204+
parserR.setBindingsRecovery(true);
195205

196206
CompilationUnit cuR = (CompilationUnit) parserR.createAST(null);
197207

@@ -203,7 +213,7 @@ public void transformFiles(int minTypeExpr, int minTypeCond, int minTypeParams,
203213

204214
symTableVisitor = new SymbolTableVisitor(typeChecker);
205215
cuR.accept(symTableVisitor);
206-
rootScope = symTableVisitor.getRoot();
216+
rootScope = symTableVisitor.getRoot();
207217

208218
typeTableVisitor = new TypeTableVisitor(rootScope, typeChecker);
209219
cuR.accept(typeTableVisitor);
@@ -226,7 +236,7 @@ public void transformFiles(int minTypeExpr, int minTypeCond, int minTypeParams,
226236
listRewrite.insertFirst(comment, null);
227237

228238

229-
System.out.println("Suiatable methods " + af.getSuitableMethods().size() + "in " + file);
239+
System.out.println("Suiatable methods " + af.getSuitableMethods().size() + " in " + file);
230240
if(af.getSuitableMethods().size() > 0) {
231241

232242
for(Object typeDecl : cuR.types()) {
@@ -263,6 +273,7 @@ public void transformFiles(int minTypeExpr, int minTypeCond, int minTypeParams,
263273

264274
} catch (Exception e) {
265275
System.out.println("Exception " + e + " while transforming file " + file.getAbsolutePath());
276+
e.printStackTrace();
266277
}
267278
}
268279
}

src/java/transform/TypeChecking/TypeChecker.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,11 @@ public static boolean isIntegerType(Type type) {
199199

200200
public static boolean isRealType(Type type) {
201201
boolean ret = false;
202-
if(type != null) {
203-
if(type != null && type.isPrimitiveType()) {
204-
Code typeCode = ((PrimitiveType) type).getPrimitiveTypeCode();
205-
if(typeCode == PrimitiveType.DOUBLE ||
206-
typeCode == PrimitiveType.FLOAT) {
207-
ret = true;
208-
}
202+
if(type != null && type.isPrimitiveType()) {
203+
Code typeCode = ((PrimitiveType) type).getPrimitiveTypeCode();
204+
if(typeCode == PrimitiveType.DOUBLE ||
205+
typeCode == PrimitiveType.FLOAT) {
206+
ret = true;
209207
}
210208
}
211209

src/java/transform/visitors/TransformVisitor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ public void endVisit(InfixExpression node) {
394394
replaceBoolean(lhs);
395395
typeTable.setNodeType(lhs, ast.newPrimitiveType(PrimitiveType.BOOLEAN));
396396
} else if (isFloatingPointTypeCode(rhsType)) {
397-
replaceFloat(lhs);
397+
replaceFloat(lhs); // TODO: figure out why this thinks doubles are floats
398398
typeTable.setNodeType(lhs, ast.newPrimitiveType(PrimitiveType.FLOAT));
399399
} else if(isDoubleTypeCode(rhsType)) {
400400
replaceDouble(lhs);
@@ -1462,9 +1462,9 @@ private void checkReturnType(MethodDeclaration node) {
14621462

14631463
private void checkThrownExceptions(MethodDeclaration node) {
14641464
@SuppressWarnings("unchecked")
1465-
List<Name> exceptions = node.thrownExceptions();
1465+
List<Name> exceptions = node.thrownExceptionTypes();
14661466
if (!exceptions.isEmpty()) {
1467-
ListRewrite listRewrite = rewriter.getListRewrite(node, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
1467+
ListRewrite listRewrite = rewriter.getListRewrite(node, MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY);
14681468
for (Name name : exceptions) {
14691469
listRewrite.remove(name, null);
14701470
}

src/java/transform/visitors/TypeTableVisitor.java

+15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import org.eclipse.jdt.core.dom.Expression;
1616
import org.eclipse.jdt.core.dom.FieldAccess;
1717
import org.eclipse.jdt.core.dom.FieldDeclaration;
18+
import org.eclipse.jdt.core.dom.IMethodBinding;
19+
import org.eclipse.jdt.core.dom.ITypeBinding;
1820
import org.eclipse.jdt.core.dom.IfStatement;
1921
import org.eclipse.jdt.core.dom.InfixExpression;
2022
import org.eclipse.jdt.core.dom.InfixExpression.Operator;
@@ -344,6 +346,15 @@ public void endVisit(MethodInvocation node) {
344346
// table.setNodeType(node, null);
345347
// return;
346348
// }
349+
IMethodBinding methodBinding = node.resolveMethodBinding();
350+
if (methodBinding != null) {
351+
ITypeBinding typeBinding = methodBinding.getReturnType();
352+
if (typeBinding != null && typeBinding.isPrimitive()) {
353+
table.setNodeType(node, ast.newPrimitiveType(PrimitiveType.toCode(typeBinding.getName())));
354+
return;
355+
}
356+
}
357+
347358
//
348359
// Type type = table.getNodeType(expr);
349360
// if (type == null) {
@@ -356,6 +367,10 @@ public void endVisit(MethodInvocation node) {
356367
table.setNodeType(node, ast.newPrimitiveType(PrimitiveType.INT));
357368
} else if (identifier.equals("makeSymbolicBoolean")) {
358369
table.setNodeType(node, ast.newPrimitiveType(PrimitiveType.BOOLEAN));
370+
} else if (identifier.equals("makeSymbolicReal")) {
371+
table.setNodeType(node, ast.newPrimitiveType(PrimitiveType.DOUBLE));
372+
} else if (identifier.equals("makeSymbolicFloat")) {
373+
table.setNodeType(node, ast.newPrimitiveType(PrimitiveType.FLOAT));
359374
} else {
360375
table.setNodeType(node, null);
361376
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Copyright (c) 2010 Yahoo! Inc. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you
5+
* may not use this file except in compliance with the License. You
6+
* may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13+
* implied. See the License for the specific language governing
14+
* permissions and limitations under the License. See accompanying
15+
* LICENSE file.
16+
*/
17+
package com.yahoo.ycsb;
18+
19+
/**
20+
* A ByteIterator that generates a random sequence of bytes.
21+
*/
22+
public class RandomByteIterator extends ByteIterator {
23+
private long len;
24+
private long off;
25+
private int bufOff;
26+
private byte[] buf;
27+
28+
@Override
29+
public int nextBuf(byte[] buffer, int bufferOffset) {
30+
int ret;
31+
if(len - off < buffer.length - bufferOffset) {
32+
ret = (int)(len - off);
33+
} else {
34+
ret = buffer.length - bufferOffset;
35+
}
36+
int i;
37+
for(i = 0; i < ret; i+=6) {
38+
fillBytesImpl(buffer, i + bufferOffset);
39+
}
40+
off+=ret;
41+
return ret + bufferOffset;
42+
}
43+
}

0 commit comments

Comments
 (0)