copilot spring boot agent implementation

This commit is contained in:
vudayani
2024-09-25 09:25:02 +05:30
committed by Martin Lippert
parent a63fc2a541
commit 3d18619e98
23 changed files with 693 additions and 16 deletions

View File

@@ -30,19 +30,22 @@ public class ClasspathData implements IClasspath {
final public static ClasspathData EMPTY_CLASSPATH_DATA = new ClasspathData(
null,
Collections.emptySet()
Collections.emptySet(),
null
);
private String name;
private Set<CPE> classpathEntries;
private String javaVersion;
private Cache<String, Optional<CPE>> binaryLibLookupCache;
public ClasspathData() {}
public ClasspathData(String name, Collection<CPE> classpathEntries) {
public ClasspathData(String name, Collection<CPE> classpathEntries, String javaVersion) {
this.name = name;
this.classpathEntries = ImmutableSet.copyOf(classpathEntries);
this.javaVersion = javaVersion;
this.binaryLibLookupCache = CacheBuilder.newBuilder().build();
}
@@ -56,7 +59,8 @@ public class ClasspathData implements IClasspath {
}
return new ClasspathData(
d.getName(),
entries==null ? ImmutableSet.of() : entries
entries==null ? ImmutableSet.of() : entries,
d.getJavaVersion()
);
}
@@ -68,6 +72,15 @@ public class ClasspathData implements IClasspath {
public void setName(String name) {
this.name = name;
}
@Override
public String getJavaVersion() {
return javaVersion;
}
public void setJavaVersion(String javaVersion) {
this.javaVersion = javaVersion;
}
@Override
public Set<CPE> getClasspathEntries() {

View File

@@ -79,6 +79,11 @@ public class DelegatingCachedClasspath implements IClasspath {
public ImmutableList<CPE> getClasspathEntries() throws Exception {
return ImmutableList.copyOf(cachedData.get().getClasspathEntries());
}
@Override
public String getJavaVersion() {
return cachedData.get().getJavaVersion();
}
public boolean isCached() {
return fileBasedCache.isCached();

View File

@@ -31,7 +31,7 @@ public interface IClasspath {
public static final Logger log = LoggerFactory.getLogger(IClasspath.class);
String getName();
/**
* Classpath entries paths
*
@@ -58,4 +58,10 @@ public interface IClasspath {
return Optional.empty();
}
/**
* Finds Java Version by parsing the classpath entries
* @return returns java version
*/
String getJavaVersion();
}

View File

@@ -63,7 +63,7 @@ public class JandexClasspathTest {
ClasspathData getClasspath() {
return new ClasspathData(name, ImmutableList.of(
CPE.source(new File(root, "src"), outputFolder)
));
), "");
}
JandexClasspath getJandexClasspath() {