Skip to content

Commit

Permalink
EDIT: Some smaller improvements for code style.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaglam committed Jan 10, 2018
1 parent f90a27a commit 307e52e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
5 changes: 2 additions & 3 deletions src/main/java/eme/extractor/DataTypeExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ public Set<String> getDataTypes() {
}

/**
* Extracts bounds for an {@link ExtractedTypeParameter} from an array of bound
* signatures. Needs an declaring type, which is the {@link IType} itself or the declaring type of an
* {@link IMethod}.
* Extracts bounds for an {@link ExtractedTypeParameter} from an array of bound signatures. Needs an declaring type,
* which is the {@link IType} itself or the declaring type of an {@link IMethod}.
*/
private void extractBounds(ExtractedTypeParameter parameter, String[] signatures, IType declaringType) throws JavaModelException {
for (String bound : signatures) { // if has bound:
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/eme/extractor/JavaTypeExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,24 @@ public ExtractedType extractType(IType type) throws JavaModelException {
return extractedType;
}

/**
* Checks whether an {@link IType} inherits from the class {@link java.lang.Throwable}
*/
private boolean extendsThrowable(IType type) throws JavaModelException {
ITypeHierarchy hierarchy = type.newSupertypeHierarchy(new NullProgressMonitor()); // get super type hierarchy
for (IType superType : hierarchy.getAllSuperclasses(type)) { // for every super type
if (Throwable.class.getName().equals(superType.getFullyQualifiedName())) { // if is called throwable
return true; // is true
}
}
return false; // is false
}

/**
* Parses an {@link IType} that has been identified as class.
*/
private ExtractedClass extractClass(IType type) throws JavaModelException {
boolean throwable = inheritsFromThrowable(type);
boolean throwable = extendsThrowable(type);
ExtractedClass newClass = new ExtractedClass(getName(type), isAbstract(type), throwable);
String signature = type.getSuperclassTypeSignature();
if (signature != null) { // get full super type:
Expand Down Expand Up @@ -136,17 +149,4 @@ private void extractOuterType(IType type, ExtractedType extractedType) {
extractedType.setOuterType(getName(outerType)); // add outer type name
}
}

/**
* Checks whether an {@link IType} inherits from the class {@link java.lang.Throwable}
*/
private boolean inheritsFromThrowable(IType type) throws JavaModelException {
ITypeHierarchy hierarchy = type.newSupertypeHierarchy(new NullProgressMonitor()); // get super type hierarchy
for (IType superType : hierarchy.getAllSuperclasses(type)) { // for every super type
if ("java.lang.Throwable".equals(superType.getFullyQualifiedName())) { // if is called throwable
return true; // is true
}
}
return false; // is false
}
}
1 change: 0 additions & 1 deletion src/main/java/eme/model/datatypes/ExtractedField.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
public class ExtractedField extends ExtractedVariable {
private boolean finalAttribute;
private AccessLevelModifier modifier;

private boolean staticAttribute;

/**
Expand Down

0 comments on commit 307e52e

Please sign in to comment.