-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Language Specifics in Symbol Extraction
LanguageSpecifics add specific information to symbol/scopes for Classes, methods and fields. It's relate to - access modifiers - annotations - super class - interfaces - return type
- Loading branch information
Showing
7 changed files
with
624 additions
and
35 deletions.
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
...ava-agent/agent-debugger/src/main/java/com/datadog/debugger/symbol/LanguageSpecifics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
package com.datadog.debugger.symbol; | ||
|
||
import com.datadog.debugger.agent.Generated; | ||
import com.squareup.moshi.Json; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class LanguageSpecifics { | ||
@Json(name = "access_modifiers") | ||
private final List<String> accessModifiers; | ||
|
||
private final List<String> annotations; | ||
|
||
@Json(name = "super_class") | ||
private final String superClass; | ||
|
||
private final List<String> interfaces; | ||
|
||
@Json(name = "return_type") | ||
private final String returnType; | ||
|
||
public LanguageSpecifics( | ||
List<String> accessModifiers, | ||
List<String> annotations, | ||
String superClass, | ||
List<String> interfaces, | ||
String returnType) { | ||
this.accessModifiers = accessModifiers; | ||
this.annotations = annotations; | ||
this.superClass = superClass; | ||
this.interfaces = interfaces; | ||
this.returnType = returnType; | ||
} | ||
|
||
public List<String> getAccessModifiers() { | ||
return accessModifiers; | ||
} | ||
|
||
public List<String> getAnnotations() { | ||
return annotations; | ||
} | ||
|
||
public String getSuperClass() { | ||
return superClass; | ||
} | ||
|
||
public List<String> getInterfaces() { | ||
return interfaces; | ||
} | ||
|
||
public String getReturnType() { | ||
return returnType; | ||
} | ||
|
||
@Generated | ||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
LanguageSpecifics that = (LanguageSpecifics) o; | ||
return Objects.equals(accessModifiers, that.accessModifiers) | ||
&& Objects.equals(annotations, that.annotations) | ||
&& Objects.equals(superClass, that.superClass) | ||
&& Objects.equals(interfaces, that.interfaces) | ||
&& Objects.equals(returnType, that.returnType); | ||
} | ||
|
||
@Generated | ||
@Override | ||
public int hashCode() { | ||
return Objects.hash(accessModifiers, annotations, superClass, interfaces, returnType); | ||
} | ||
|
||
@Generated | ||
@Override | ||
public String toString() { | ||
return "LanguageSpecifics{" | ||
+ "accessModifiers=" | ||
+ accessModifiers | ||
+ ", annotations=" | ||
+ annotations | ||
+ ", superClass='" | ||
+ superClass | ||
+ '\'' | ||
+ ", interfaces=" | ||
+ interfaces | ||
+ ", returnType='" | ||
+ returnType | ||
+ '\'' | ||
+ '}'; | ||
} | ||
|
||
public static class Builder { | ||
private List<String> accessModifiers; | ||
private List<String> annotations; | ||
private String superClass; | ||
private List<String> interfaces; | ||
private String returnType; | ||
|
||
public Builder addModifiers(Collection<String> modifiers) { | ||
if (modifiers == null || modifiers.isEmpty()) { | ||
this.accessModifiers = null; | ||
return this; | ||
} | ||
accessModifiers = new ArrayList<>(modifiers); | ||
return this; | ||
} | ||
|
||
public Builder addAnnotations(Collection<String> annotations) { | ||
if (annotations == null || annotations.isEmpty()) { | ||
this.annotations = null; | ||
return this; | ||
} | ||
this.annotations = new ArrayList<>(annotations); | ||
return this; | ||
} | ||
|
||
public Builder superClass(String superClass) { | ||
this.superClass = superClass; | ||
return this; | ||
} | ||
|
||
public Builder addInterfaces(Collection<String> interfaces) { | ||
if (interfaces == null || interfaces.isEmpty()) { | ||
this.interfaces = null; | ||
return this; | ||
} | ||
this.interfaces = new ArrayList<>(interfaces); | ||
return this; | ||
} | ||
|
||
public Builder returnType(String returnType) { | ||
this.returnType = returnType; | ||
return this; | ||
} | ||
|
||
public LanguageSpecifics build() { | ||
return new LanguageSpecifics( | ||
accessModifiers, annotations, superClass, interfaces, returnType); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.