Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Fix object getType() API usage #344

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion native/src/main/java/io/ballerina/stdlib/stan/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static byte[] convertDataIntoByteArray(Object data) {

public static MethodType getAttachedFunctionType(BObject serviceObject, String functionName) {
MethodType function = null;
ObjectType objectType = (ObjectType) TypeUtils.getReferredType(serviceObject.getType());
ObjectType objectType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(serviceObject));
MethodType[] resourceFunctions = objectType.getMethods();
for (MethodType resourceFunction : resourceFunctions) {
if (functionName.equals(resourceFunction.getName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static Object attach(Environment environment, BObject streamingListener,
Object serviceName) {
String subject;
Object streamingConnectionUrl = streamingListener.getNativeData(Constants.URL.getValue());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
@SuppressWarnings("unchecked")
BMap<BString, Object> annotation = (BMap<BString, Object>) serviceType
.getAnnotation(StringUtils.fromString(Utils.getModule().getOrg() + ORG_NAME_SEPARATOR +
Expand All @@ -73,7 +73,7 @@ public static Object attach(Environment environment, BObject streamingListener,
}

private static boolean getAckMode(BObject service) {
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
@SuppressWarnings("unchecked")
BMap<BString, Object> serviceConfig = (BMap<BString, Object>) serviceType
.getAnnotation(StringUtils.fromString(Utils.getModule().getOrg() + ORG_NAME_SEPARATOR +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void executeResource(String subject, Object[] args, Type returnType) {
CountDownLatch countDownLatch = new CountDownLatch(1);
StrandMetadata metadata = new StrandMetadata(Utils.getModule().getOrg(), Utils.getModule().getName(),
Utils.getModule().getVersion(), Constants.ON_MESSAGE_RESOURCE);
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
if (ObserveUtils.isTracingEnabled()) {
Map<String, Object> properties = new HashMap<>();
NatsObserverContext observerContext = new NatsObserverContext(NatsObservabilityConstants.CONTEXT_CONSUMER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void streamingSubscribe(BObject streamingListener) {
private static Subscription createSubscription(BObject service, StreamingListener messageHandler,
io.nats.streaming.StreamingConnection streamingConnection,
NatsMetricsReporter natsMetricsReporter) {
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
BMap<BString, Object> annotation = (BMap<BString, Object>) serviceType
.getAnnotation(StringUtils.fromString(Utils.getModule().getOrg() + ORG_NAME_SEPARATOR +
Utils.getModule().getName() + VERSION_SEPARATOR +
Expand Down