Skip to content

Commit bcf321e

Browse files
Add additional comments for scala detection
1 parent d026dcc commit bcf321e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

newrelic-agent/src/main/java/com/newrelic/agent/language/SourceLibraryDetector.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private void detectJava() {
9292

9393
private void detectScala3(ClassLoader systemClassLoader) {
9494
try {
95-
//scala3-library removed all methods referencing the version number, so we just capture the major version
95+
//scala3-library removed all methods referencing the version 3 number, so we only capture the major version
9696
//by checking for a class introduced in the scala 3 API.
9797
Class<?> aClass = Class.forName("scala.deriving.Mirror", true, systemClassLoader);
9898
if (aClass != null) {
@@ -107,7 +107,8 @@ private void detectScala3(ClassLoader systemClassLoader) {
107107

108108
private void detectScala(ClassLoader systemClassLoader) {
109109
try {
110-
// Scala has a static versionNumberString method that can be invoked to get the version number
110+
// Scala has a static versionNumberString method that can be invoked to get the version number.
111+
// A scala 3 app will also capture this metric, because scala 3 includes the scala 2.13 library.
111112
Class<?> aClass = Class.forName(SCALA_VERSION_CLASS, true, systemClassLoader);
112113
if (aClass != null) {
113114
String version = (String) aClass.getMethod(SCALA_VERSION_METHOD).invoke(null);

0 commit comments

Comments
 (0)