-
Notifications
You must be signed in to change notification settings - Fork 740
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
[Refactoring] Fix constant expressions #43035
base: master
Are you sure you want to change the base?
[Refactoring] Fix constant expressions #43035
Conversation
@@ -263,8 +263,7 @@ public static boolean isJSONObject(Object json) { | |||
|
|||
MapValueImpl<BString, Object> map = new MapValueImpl<>(mapType); | |||
Type mapConstraint = TypeUtils.getImpliedType(mapType.getConstrainedType()); | |||
if (mapConstraint == null || mapConstraint.getTag() == TypeTags.ANY_TAG || | |||
mapConstraint.getTag() == TypeTags.JSON_TAG) { | |||
if (mapConstraint.getTag() == TypeTags.ANY_TAG || mapConstraint.getTag() == TypeTags.JSON_TAG) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in here do we handle mapConstraint == null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeUtils.getImpliedType
was inferred to always return non null values by IntelliJ.
See also the definition of TypeUtils.getImpliedType
:
ballerina-lang/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/utils/TypeUtils.java
Lines 176 to 190 in c0c17f8
public static Type getImpliedType(Type type) { | |
Type impliedType = type.getCachedImpliedType(); | |
if (impliedType != null) { | |
return impliedType; | |
} | |
type = getReferredType(type); | |
if (type.getTag() == TypeTags.INTERSECTION_TAG) { | |
impliedType = getImpliedType(((IntersectionType) type).getEffectiveType()); | |
} else { | |
impliedType = type; | |
} | |
type.setCachedImpliedType(impliedType); | |
return impliedType; | |
} |
It recursively calls itself until it finds a non null value or returns whatever
getReferredType
returns, but this has to be not null, since we access type.getTag()
.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Remove stale status |
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/TableOmDataSource.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/TableOmDataSource.java
Outdated
Show resolved
Hide resolved
bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/scheduling/Strand.java
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
f481184
to
e37357d
Compare
51cdec1
to
2e64ec2
Compare
2e64ec2
to
9437bf7
Compare
Purpose
Approach
Samples
Remarks
Check List