Skip to content
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] InternalExecutionError on assignment of inherited instance variables from abstract class #1406

Closed
jaelee125 opened this issue Mar 19, 2024 · 8 comments
Labels
BUG P3 Rarely Malfunction duplicate This issue or pull request already exists SFGE Issues related to the Salesforce Graph Engine

Comments

@jaelee125
Copy link

jaelee125 commented Mar 19, 2024

I'm not exactly sure what the issue is. SN_Constants class is a class we use to store constants. This class only has public static final String, Integer, Map, List, and Set.

Error and stacktrace: UnexpectedException: Undefined variable. key=mappingType, value=ApexStringValue{ value=Optional[Object]} ApexValue(ApexStringValue) {status=INITIALIZED, declarationVertex=ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=UNINITIALIZED, declarationVertex=Field{properties={FirstChild=false, BeginLine=50, Type=String, DefiningType_CaseSafe=sn_constants, LastChild=false, DefiningType=SN_Constants, EndLine=50, Name_CaseSafe=config_type_object, childIdx=24, BeginColumn=29, Name=CONFIG_TYPE_OBJECT}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}, valueVertex=LiteralExpression{properties={FirstChild=true, BeginLine=50, DefiningType_CaseSafe=sn_constants, LastChild=false, DefiningType=SN_Constants, EndLine=50, Value=Object, childIdx=0, LiteralType=STRING, BeginColumn=50}}, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}: com.salesforce.graph.symbols.MethodInvocationScope.updateVariable(MethodInvocationScope.java:114);com.salesforce.graph.symbols.AbstractClassInstanceScope.updateVariable(AbstractClassInstanceScope.java:129);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1005);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:744);com.salesforce.graph.vertex.AssignmentExpressionVertex.afterVisit(AssignmentExpressionVertex.java:37)

@jaelee125 jaelee125 changed the title [BUG] InternalExecutionError [BUG] InternalExecutionError on assignment of inherited instance variables from abstract class Mar 20, 2024
@jaelee125
Copy link
Author

jaelee125 commented Apr 10, 2024

`public with sharing class SN_MetadataWrappers {

public abstract class ObjectsAndFieldsDefinitionWrapper extends MetadataWrapper {		
	@AuraEnabled public String type;
	@AuraEnabled public String networkObject;
}

public class ObjectDefinitionWrapper extends ObjectsAndFieldsDefinitionWrapper {

	public ObjectDefinitionWrapper(Map<String, Object> wrapperMap) {
		type = SN_Constants.CONFIG_TYPE_OBJECT;
		networkObject = (String) wrapperMap.get(NETWORK_OBJECT_KEY);
	}
}

}`

SN_MetadataWrappers.ObjectDefinitionWrapper objectWrapper = new SN_MetadataWrappers.ObjectDefinitionWrapper(objectMap);

The above fails. If I duplicate inherited instance variables in the class, it passes.
Adding Engine Directives does not work for this error

"1","3","/Users/jae/code/specright-network/specright-network/main/default/classes/SN_Modules/SN_Settings/SN_SettingsController.cls","355","29","SN_SettingsController","getSpecrightNetworkTemplateMappings","","","","InternalExecutionError","Graph Engine identified your source and sink, but you must manually verify that you have a sanitizer in this path. Then, add an engine directive to skip the path. Next, create a Github issue for the Code Analyzer team that includes the error and stack trace. After we fix this issue, check the Code Analyzer release notes for more info. Error and stacktrace: UnexpectedException: Undefined variable. key=type, value=ApexStringValue{ value=Optional[Object]} ApexValue(ApexStringValue) {status=INITIALIZED, declarationVertex=ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=UNINITIALIZED, declarationVertex=Field{properties={FirstChild=false, BeginLine=52, Type=String, DefiningType_CaseSafe=sn_constants, LastChild=false, DefiningType=SN_Constants, EndLine=52, Name_CaseSafe=config_type_object, childIdx=25, BeginColumn=29, Name=CONFIG_TYPE_OBJECT}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}, valueVertex=LiteralExpression{properties={FirstChild=true, BeginLine=52, DefiningType_CaseSafe=sn_constants, LastChild=false, DefiningType=SN_Constants, EndLine=52, Value=Object, childIdx=0, LiteralType=STRING, BeginColumn=50}}, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}: com.salesforce.graph.symbols.MethodInvocationScope.updateVariable(MethodInvocationScope.java:114);com.salesforce.graph.symbols.AbstractClassInstanceScope.updateVariable(AbstractClassInstanceScope.java:129);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1005);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:744);com.salesforce.graph.vertex.AssignmentExpressionVertex.afterVisit(AssignmentExpressionVertex.java:37)","https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/apexflsviolation-rule.html","InternalExecutionError","sfge"

@jaelee125
Copy link
Author

@sagar-j-sfdc Do you have any work arounds for this or any idea to get the engine directives to work for this issue?

@jaelee125
Copy link
Author

@jfeingold35 Any update on this?

@jfeingold35
Copy link
Collaborator

Unfortunately, no updates at this time. We'll look into it and let you know once we have something. Thank you for your patience.

@jfeingold35
Copy link
Collaborator

@jaelee125 , we're able to reproduce. It looks like the problem is that the scope of the child class isn't automatically receiving the properties inherited from the parent class.
Unfortunately, the fix looks to be possibly non-trivial. We'll add it to our backlog, but in the meantime, if your workaround is unblocking you, we recommend continuing to use it.

@jfeingold35 jfeingold35 added the BUG P3 Rarely Malfunction label May 7, 2024
Copy link

git2gus bot commented May 7, 2024

This issue has been linked to a new work item: W-15705191

@jaelee125
Copy link
Author

@jfeingold35 We currently don't have a workaround for this but we'll document it in the security review. Thanks

@stephen-carter-at-sf stephen-carter-at-sf added the SFGE Issues related to the Salesforce Graph Engine label May 23, 2024
@stephen-carter-at-sf stephen-carter-at-sf added the duplicate This issue or pull request already exists label Jun 3, 2024
@stephen-carter-at-sf
Copy link
Collaborator

Marking this a duplicate of #1497

@stephen-carter-at-sf stephen-carter-at-sf closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG P3 Rarely Malfunction duplicate This issue or pull request already exists SFGE Issues related to the Salesforce Graph Engine
Projects
None yet
Development

No branches or pull requests

3 participants