Skip to content

Commit 2584447

Browse files
committed
Merge remote-tracking branch 'upstream/2201.13.x' into 2201.13.x
# Conflicts: # compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java
2 parents 2de882c + 95b4286 commit 2584447

File tree

1,734 files changed

+32631
-9086
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,734 files changed

+32631
-9086
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# See: https://help.github.com/articles/about-codeowners/
55

6-
* @gimantha
6+
* @keizer619 @gimantha
77

88
# Components
99
/compiler/ @sameerajayasoma @hasithaa @gimantha @MaryamZi
@@ -42,4 +42,4 @@
4242
/tests/testerina-integration-test/ @azinneera
4343

4444
# CODEOWNERS file
45-
/.github/CODEOWNERS @sameerajayasoma @gimantha @MaryamZi @hasithaa
45+
/.github/CODEOWNERS @sameerajayasoma @gimantha @MaryamZi @hasithaa @keizer619

.github/workflows/pull_request_full_build.yml

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
pull_request:
55
branches:
66
- master
7-
- 2201.[0-9]+.x
8-
- 2201.[0-9]+.[0-9]+-stage
7+
- 2201.[0-9]+.0-stage
98

109
jobs:
1110
build-lang:
@@ -97,26 +96,19 @@ jobs:
9796
- name: Download Module Data
9897
run: |
9998
wget https://raw.githubusercontent.com/ballerina-platform/ballerina-release/master/dependabot/resources/extensions.json
100-
wget https://raw.githubusercontent.com/ballerina-platform/ballerina-distribution/2201.0.x/gradle.properties
99+
wget https://raw.githubusercontent.com/ballerina-platform/ballerina-distribution/master/gradle.properties
101100
102-
# - name: Clone Modules
103-
# run: |
104-
# for module_name in $(jq -r '.standard_library| .[] | select(.level==${{ matrix.level }}) | .name' extensions.json); \
105-
# do git clone https://github.com/ballerina-platform/${module_name}.git; \
106-
# done
107101
- name: Clone Modules
108102
run: |
109103
for module_name in $(jq -r '.standard_library| .[] | select(.level==${{ matrix.level }}) | .name' extensions.json); do
110104
echo "Cloning module: ${module_name}"
111-
repo_url=https://github.com/ballerina-platform/${module_name}.git
112-
branch=metrics-logs
113-
if git ls-remote --heads "$repo_url" "$branch" | grep -q "$branch"; then
114-
echo "Branch '$branch' found."
115-
git clone -b "$branch" --single-branch "$repo_url"
105+
if [[ $module_name == *-tool ]]; then
106+
repo_name="${module_name}s"
116107
else
117-
echo "Branch '$branch' not found. Cloning default branch '$default_branch' instead."
118-
git clone $repo_url
108+
repo_name="${module_name}"
119109
fi
110+
repo_url="https://github.com/ballerina-platform/${repo_name}.git"
111+
git clone $repo_url
120112
done
121113
shell: bash
122114

@@ -132,21 +124,17 @@ jobs:
132124
perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ needs.build-lang.outputs.lang_version }}/" ${module_name}/gradle.properties; \
133125
done
134126
135-
- name: Update Observe Module Version
136-
run: |
137-
OBSERVE_VERSION=1.5.0-20250304-140800-d60274b
138-
OBSERVE_INTERNAL_VERSION=1.5.0-20250305-160800-51dc066
139-
for module_name in $(jq -r '.standard_library| .[] | select(.level==${{ matrix.level }}) | .name' extensions.json); do \
140-
perl -pi -e "s/^\s*observeVersion=.*/observeVersion=${OBSERVE_VERSION}/" ${module_name}/gradle.properties && \
141-
perl -pi -e "s/^\s*observeInternalVersion=.*/observeInternalVersion=${OBSERVE_INTERNAL_VERSION}/" ${module_name}/gradle.properties; \
142-
done
143-
144127
- name: Build Module
145128
run: |
146-
for module_name in $(jq -r '.standard_library| .[] | select(.level==${{ matrix.level }}) | .name' extensions.json); do \
147-
echo "Building Standard Library: $module_name" && \
148-
cd $module_name && ./gradlew clean build --stacktrace --scan && cd ..; \
129+
for module_name in $(jq -r '.standard_library| .[] | select(.level==${{ matrix.level }}) | .name' extensions.json); do
130+
if [[ $module_name == *-tool ]]; then
131+
repo_name="${module_name}s"
132+
else
133+
repo_name="${module_name}"
134+
fi
135+
echo "Building Standard Library: $repo_name" && cd $repo_name && ./gradlew clean build --stacktrace --scan && cd ..
149136
done
137+
shell: bash
150138
env:
151139
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
152140
packagePAT: ${{ secrets.GITHUB_TOKEN }}
@@ -196,13 +184,6 @@ jobs:
196184
run: |
197185
perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ needs.build-lang.outputs.lang_version }}/" gradle.properties
198186
199-
- name: Update Observe Module Version
200-
run: |
201-
OBSERVE_VERSION=1.5.0-20250304-140800-d60274b
202-
OBSERVE_INTERNAL_VERSION=1.5.0-20250305-160800-51dc066
203-
perl -pi -e "s/^\s*observeVersion=.*/observeVersion=${OBSERVE_VERSION}/" gradle.properties
204-
perl -pi -e "s/^\s*observeInternalVersion=.*/observeInternalVersion=${OBSERVE_INTERNAL_VERSION}/" gradle.properties
205-
206187
- name: Build Module
207188
run: ./gradlew clean build --stacktrace --scan --console=plain --no-daemon --continue -x :project-api-tests:test
208189
env:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# The Ballerina programming language
88

9-
[Ballerina](https://ballerina.io/) is an open-source cloud-native programming language optimized for integration. It is developed and supported by [WSO2](https://wso2.com/).
9+
[Ballerina](https://ballerina.io/) is an open-source, cloud-native programming language optimized for integration. It is developed and supported by [WSO2](https://wso2.com/).
1010

1111
With Ballerina, you could easily develop microservices, API endpoints and integrations,
1212
and any other application for the cloud. Additionally, Ballerina has all the general-purpose

ballerina-shell/modules/shell-core/src/main/java/io/ballerina/shell/invoker/ShellSnippetsInvoker.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,13 @@ protected Object callRun(ClassLoader classLoader, io.ballerina.runtime.api.Modul
407407
if (result instanceof Throwable throwable) {
408408
throw new InvokerPanicException(throwable);
409409
}
410+
} catch (BError bError) {
411+
throw new InvokerPanicException(bError);
410412
} catch (Throwable throwable) {
413+
Throwable cause = throwable.getCause();
414+
if (cause instanceof BError bError) {
415+
throw new InvokerPanicException(bError);
416+
}
411417
throw new InvokerPanicException(throwable);
412418
} finally {
413419
try {

ballerina-shell/modules/shell-core/src/test/resources/testcases/evaluator/operations.cast.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
{
6060
"description": "Casting to incorrect type.",
6161
"code": "Department department = <Department>value;",
62-
"stdout": "panic: {ballerina}TypeCastError {\"message\":\"incompatible types: 'Employee' cannot be cast to 'Department'\"}\n",
62+
"stdout": "panic: {ballerina}TypeCastError {\"message\":\"incompatible types: 'Employee' cannot be cast to 'Department'\"}\nat ..<init>()\n",
6363
"error": "InvokerPanicException"
6464
}
6565
]

bvm/ballerina-profiler/src/main/java/io/ballerina/runtime/profiler/runtime/StackTraceMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ static String getCallStackString(String stackKey) {
6262
}
6363

6464
private static String decodeStackElement(String stackElement) {
65-
return Utils.decodeIdentifier(stackElement.replace("$value$", ""));
65+
return Utils.decodeIdentifier(stackElement.replace("values.\\$", ""));
6666
}
6767
}

bvm/ballerina-rt/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ dependencies {
4242
dist project(path: ':ballerina-lang:future', configuration: 'distributionBirJar')
4343
dist project(path: ':ballerina-lang:integer', configuration: 'distributionBirJar')
4444
dist project(path: ':ballerina-lang:map', configuration: 'distributionBirJar')
45+
dist project(path: ':ballerina-lang:natural', configuration: 'distributionBirJar')
4546
dist project(path: ':ballerina-lang:object', configuration: 'distributionBirJar')
4647
dist project(path: ':ballerina-lang:stream', configuration: 'distributionBirJar')
4748
dist project(path: ':ballerina-lang:table', configuration: 'distributionBirJar')
@@ -66,6 +67,7 @@ dependencies {
6667
dist project(':ballerina-lang:future')
6768
dist project(':ballerina-lang:integer')
6869
dist project(':ballerina-lang:map')
70+
dist project(':ballerina-lang:natural')
6971
dist project(':ballerina-lang:object')
7072
dist project(':ballerina-lang:stream')
7173
dist project(':ballerina-lang:table')

bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/creators/TypeCreator.java

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import io.ballerina.runtime.internal.types.BUnionType;
5050
import io.ballerina.runtime.internal.types.BXmlType;
5151
import io.ballerina.runtime.internal.types.semtype.CacheFactory;
52+
import io.ballerina.runtime.internal.values.ValueCreator;
5253

5354
import java.util.Arrays;
5455
import java.util.IdentityHashMap;
@@ -63,8 +64,6 @@
6364
* @since 2.0.0
6465
*/
6566
public final class TypeCreator {
66-
67-
private static final RecordTypeCache registeredRecordTypes = new RecordTypeCache();
6867
/**
6968
* Creates a new array type with given element type.
7069
*
@@ -156,8 +155,8 @@ public static TupleType createTupleType(List<Type> typeList, Type restType, int
156155
* @param readonly whether immutable
157156
* @return the new tuple type
158157
*/
159-
public static TupleType createTupleType(List<Type> typeList, Type restType,
160-
int typeFlags, boolean isCyclic, boolean readonly) {
158+
public static TupleType createTupleType(List<Type> typeList, Type restType, int typeFlags, boolean isCyclic,
159+
boolean readonly) {
161160
return new BTupleType(typeList, restType, typeFlags, isCyclic, readonly);
162161
}
163162

@@ -171,8 +170,8 @@ public static TupleType createTupleType(List<Type> typeList, Type restType,
171170
* @param readonly whether immutable
172171
* @return the new tuple type
173172
*/
174-
public static TupleType createTupleType(String name, Module pkg,
175-
int typeFlags, boolean isCyclic, boolean readonly) {
173+
public static TupleType createTupleType(String name, Module pkg, int typeFlags, boolean isCyclic,
174+
boolean readonly) {
176175
return new BTupleType(name, pkg, typeFlags, isCyclic, readonly);
177176
}
178177

@@ -234,9 +233,9 @@ public static MapType createMapType(String typeName, Type constraint, Module mod
234233
*/
235234
public static RecordType createRecordType(String typeName, Module module, long flags, boolean sealed,
236235
int typeFlags) {
237-
BRecordType memo = registeredRecordType(typeName, module);
238-
if (memo != null) {
239-
return memo;
236+
RecordType recordType = getRecordType(typeName, module);
237+
if (recordType != null) {
238+
return recordType;
240239
}
241240
return new BRecordType(typeName, typeName, module, flags, sealed, typeFlags);
242241
}
@@ -255,13 +254,33 @@ public static RecordType createRecordType(String typeName, Module module, long f
255254
*/
256255
public static RecordType createRecordType(String typeName, Module module, long flags, Map<String, Field> fields,
257256
Type restFieldType, boolean sealed, int typeFlags) {
258-
BRecordType memo = registeredRecordType(typeName, module);
259-
if (memo != null) {
260-
return memo;
257+
RecordType recordType = getRecordType(typeName, module);
258+
if (recordType != null) {
259+
return recordType;
261260
}
262261
return new BRecordType(typeName, module, flags, fields, restFieldType, sealed, typeFlags);
263262
}
264263

264+
private static RecordType getRecordType(String typeName, Module module) {
265+
if (module == null) {
266+
return null;
267+
}
268+
String lookupKey = ValueCreator.getLookupKey(module, false);
269+
RecordType recordType = null;
270+
if (ValueCreator.containsValueCreator(lookupKey)) {
271+
recordType = ValueCreator.getValueCreator(lookupKey).getRecordType(typeName);
272+
}
273+
if (recordType != null) {
274+
return recordType;
275+
}
276+
// If record type definition not found, get it from test module.
277+
lookupKey = ValueCreator.getLookupKey(module, true);
278+
if (ValueCreator.containsValueCreator(lookupKey)) {
279+
return ValueCreator.getValueCreator(lookupKey).getRecordType(typeName);
280+
}
281+
return null;
282+
}
283+
265284
/**
266285
* Creates a new object type.
267286
*
@@ -541,26 +560,6 @@ public static FiniteType createFiniteType(String typeName, Set<Object> values, i
541560
private TypeCreator() {
542561
}
543562

544-
private static BRecordType registeredRecordType(String typeName, Module pkg) {
545-
if (typeName == null || pkg == null) {
546-
return null;
547-
}
548-
return registeredRecordTypes.get(new TypeIdentifier(pkg, typeName));
549-
}
550-
551-
public static void registerRecordType(BRecordType recordType) {
552-
String name = recordType.getName();
553-
Module pkg = recordType.getPackage();
554-
if (name == null || pkg == null) {
555-
return;
556-
}
557-
TypeIdentifier typeIdentifier = new TypeIdentifier(pkg, name);
558-
if (typeIdentifier.avoidCaching()) {
559-
return;
560-
}
561-
registeredRecordTypes.put(typeIdentifier, recordType);
562-
}
563-
564563
public static void resetAllCaches() {
565564
RecordTypeCache.cache.clear();
566565
}

bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/utils/TypeUtils.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ public static Type getReferredType(Type type) {
136136
return referredType;
137137
}
138138
if (type.getTag() == TypeTags.TYPE_REFERENCED_TYPE_TAG) {
139-
referredType = getReferredType(((ReferenceType) type).getReferredType());
139+
Type rType = ((ReferenceType) type).getReferredType();
140+
if (rType == null) {
141+
referredType = type;
142+
} else {
143+
referredType = getReferredType(rType);
144+
}
140145
} else {
141146
referredType = type;
142147
}

bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/values/BArray.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package io.ballerina.runtime.api.values;
1919

2020
import io.ballerina.runtime.api.types.Type;
21+
import io.ballerina.runtime.internal.values.JIteratorValue;
2122

2223
/**
2324
* <p>
@@ -26,7 +27,7 @@
2627
*
2728
* @since 1.1.0
2829
*/
29-
public interface BArray extends BRefValue, BCollection, IterableValue {
30+
public interface BArray extends BRefValue, BCollection, JIteratorValue {
3031

3132
/**
3233
* Get value in the given array index.

0 commit comments

Comments
 (0)