Skip to content

Commit

Permalink
Updating project's configs. Correcting possible arrayindexoutofbounds…
Browse files Browse the repository at this point in the history
…exception point.
  • Loading branch information
Mariana Azevedo committed Jul 14, 2018
1 parent adc469a commit e24aa83
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ Bundle-ClassPath: lib/jcommon-1.0.16.jar,
lib/commons-csv-1.0.jar,
lib/jsefa-1.0.0.RELEASE.jar,
lib/log4j-1.2.17.jar
Automatic-Module-Name: O3SMeasures
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ public boolean visit(CompilationUnit node) {
private void calculateClazzUsed(CompilationUnit unit){

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public void addMethod(String method, Set<String> methodSet) {
* @since 13/07/2014
* @param methods
*/
@SuppressWarnings("deprecation")
private void checkMethodsWithSharedAttributes(IMethod[] methods){

IScanner scanner = null;
Expand Down
2 changes: 1 addition & 1 deletion src/com/o3smeasures/structures/Measure.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public enum Granularity {

public Measure(){
applicableGranularities = new ArrayList<>(4);
parser = ASTParser.newParser(AST.JLS9);
parser = ASTParser.newParser(AST.JLS10);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setResolveBindings(true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/o3smeasures/util/JavaParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static CompilationUnit parseAST(FileInputStream fileInputStream){
ASTSession.getInstance().reset();

if (cacheParser) {
astParser = ASTParser.newParser(AST.JLS9);
astParser = ASTParser.newParser(AST.JLS10);
astParser.setKind(ASTParser.K_COMPILATION_UNIT);
astParser.setResolveBindings(true);
char[] source = getFileContent(fileInputStream);
Expand Down

0 comments on commit e24aa83

Please sign in to comment.