-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Getting a NoSuchFieldError
when running tests for Ballerina IO package with Dead code elimination
#43554
Comments
NoSuchFieldError
for tests in Ballerina IO package when using Dead code eliminationNoSuchFieldError
when running tests for Ballerina IO package with Dead code elimination
Without adding the annotations, if we use This may still be a bug though. In the report, |
The issue seems to be due to the |
When we special case such types the original errors go away, but then I see errors similar to that reported in #43552. diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/UsedTypeDefAnalyzer.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/UsedTypeDefAnalyzer.java
index 0fb5137c051..d0e16870aa5 100644
--- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/UsedTypeDefAnalyzer.java
+++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/UsedTypeDefAnalyzer.java
@@ -20,6 +20,7 @@ package io.ballerina.projects;
import org.wso2.ballerinalang.compiler.PackageCache;
import org.wso2.ballerinalang.compiler.bir.model.BIRNode;
import org.wso2.ballerinalang.compiler.semantics.model.SimpleBTypeAnalyzer;
+import org.wso2.ballerinalang.compiler.semantics.model.SymbolTable;
import org.wso2.ballerinalang.compiler.semantics.model.types.BType;
import org.wso2.ballerinalang.compiler.util.CompilerContext;
import org.wso2.ballerinalang.compiler.util.TypeTags;
@@ -43,11 +44,13 @@ public final class UsedTypeDefAnalyzer extends SimpleBTypeAnalyzer<UsedTypeDefAn
private final Set<BType> visitedTypes = new HashSet<>();
private final PackageCache pkgCache;
private final UsedBIRNodeAnalyzer usedBIRNodeAnalyzer;
+ private final SymbolTable symbolTable;
private UsedTypeDefAnalyzer(CompilerContext context) {
context.put(BIR_TYPE_DEF_ANALYZER_KEY, this);
this.pkgCache = PackageCache.getInstance(context);
this.usedBIRNodeAnalyzer = UsedBIRNodeAnalyzer.getInstance(context);
+ this.symbolTable = SymbolTable.getInstance(context);
}
public static UsedTypeDefAnalyzer getInstance(CompilerContext context) {
@@ -177,6 +180,7 @@ public final class UsedTypeDefAnalyzer extends SimpleBTypeAnalyzer<UsedTypeDefAn
}
return usedBIRNodeAnalyzer.isTestablePkgAnalysis &&
+ !bType.tsymbol.pkgID.equals(symbolTable.langAnnotationModuleSymbol.pkgID) && // built-in types
!bType.tsymbol.pkgID.equals(usedBIRNodeAnalyzer.currentPkgID);
} |
We've added some fixes which are available with |
Fixed in #43557. |
Description
Steps to Reproduce
Update Ballerina lang version to
2201.11.0-20241101-105200-f94714be
in thegradle.properties
.Build Ballerina IO module (using gradle) and there will be an intermediate pack constructed in
<project-root>/target/ballerina-runtime
.Run the following command.
Affected Version(s)
Ballerina Lang version
2201.11.0-20241101-105200-f94714be
OS, DB, other environment details and versions
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: