Skip to content

Commit e24aa83

Browse files
author
Mariana Azevedo
committed
Updating project's configs. Correcting possible arrayindexoutofboundsexception point.
1 parent adc469a commit e24aa83

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ Bundle-ClassPath: lib/jcommon-1.0.16.jar,
3838
lib/commons-csv-1.0.jar,
3939
lib/jsefa-1.0.0.RELEASE.jar,
4040
lib/log4j-1.2.17.jar
41+
Automatic-Module-Name: O3SMeasures

src/com/o3smeasures/astvisitors/CouplingBetweenObjectsVisitor.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ public boolean visit(CompilationUnit node) {
6363
private void calculateClazzUsed(CompilationUnit unit){
6464

6565
Object typeDeclaration = unit.types().stream().filter(type -> type instanceof TypeDeclaration).collect(Collectors.toList());
66-
MethodDeclaration [] methods = ((List<TypeDeclaration>) typeDeclaration).get(0).getMethods();
67-
for (MethodDeclaration method: methods){
68-
Block firstMethodBody = method.getBody();
69-
Optional.ofNullable(firstMethodBody).ifPresent(m -> checkMethodStatements(method, firstMethodBody));
66+
if(!((List<TypeDeclaration>) typeDeclaration).isEmpty()){
67+
MethodDeclaration [] methods = ((List<TypeDeclaration>) typeDeclaration).get(0).getMethods();
68+
for (MethodDeclaration method: methods){
69+
Block firstMethodBody = method.getBody();
70+
Optional.ofNullable(firstMethodBody).ifPresent(m -> checkMethodStatements(method, firstMethodBody));
71+
}
7072
}
7173
}
7274

src/com/o3smeasures/javamodel/LackCohesionMethodsJavaModel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public void addMethod(String method, Set<String> methodSet) {
151151
* @since 13/07/2014
152152
* @param methods
153153
*/
154+
@SuppressWarnings("deprecation")
154155
private void checkMethodsWithSharedAttributes(IMethod[] methods){
155156

156157
IScanner scanner = null;

src/com/o3smeasures/structures/Measure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public enum Granularity {
3434

3535
public Measure(){
3636
applicableGranularities = new ArrayList<>(4);
37-
parser = ASTParser.newParser(AST.JLS9);
37+
parser = ASTParser.newParser(AST.JLS10);
3838
parser.setKind(ASTParser.K_COMPILATION_UNIT);
3939
parser.setResolveBindings(true);
4040
}

src/com/o3smeasures/util/JavaParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static CompilationUnit parseAST(FileInputStream fileInputStream){
6969
ASTSession.getInstance().reset();
7070

7171
if (cacheParser) {
72-
astParser = ASTParser.newParser(AST.JLS9);
72+
astParser = ASTParser.newParser(AST.JLS10);
7373
astParser.setKind(ASTParser.K_COMPILATION_UNIT);
7474
astParser.setResolveBindings(true);
7575
char[] source = getFileContent(fileInputStream);

0 commit comments

Comments
 (0)