Skip to content

A very simple way to specify interactions between two programming languages#2734

Open
KuechA wants to merge 4 commits into
mainfrom
ak/language-interfaces
Open

A very simple way to specify interactions between two programming languages#2734
KuechA wants to merge 4 commits into
mainfrom
ak/language-interfaces

Conversation

@KuechA

@KuechA KuechA commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

In case of incomplete code, it is possible that a function is declared in some language and then used in another programming language through some sort of interface between the languages (could be default e.g. for C/C++ or a language bridge mapping more things e.g. JNI). This is not really handled by the SymbolResolver and it would just infer new nodes if the language is not equal.

This PR suggests introducing a very basic model specifying such inter-language bridges.

Related to #2732

@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
747 1 746 13
View the top 1 failed test(s) by shortest run time
de.fraunhofer.aisec.cpg.IntegrationTest::testForeignFunctionInterface()
Stack Traces | 2.59s run time
org.opentest4j.AssertionFailedError: Expected value to be true.
	at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
	at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:138)
	at app//kotlin.test.junit5.JUnit5Asserter.fail(JUnitSupport.kt:56)
	at app//kotlin.test.Asserter.assertTrue(Assertions.kt:765)
	at app//kotlin.test.junit5.JUnit5Asserter.assertTrue(JUnitSupport.kt:30)
	at app//kotlin.test.Asserter.assertTrue(Assertions.kt:775)
	at app//kotlin.test.junit5.JUnit5Asserter.assertTrue(JUnitSupport.kt:30)
	at app//kotlin.test.AssertionsKt__AssertionsKt.assertTrue(Assertions.kt:44)
	at app//kotlin.test.AssertionsKt.assertTrue(Unknown Source)
	at app//kotlin.test.AssertionsKt__AssertionsKt.assertTrue$default(Assertions.kt:42)
	at app//kotlin.test.AssertionsKt.assertTrue$default(Unknown Source)
	at app//de.fraunhofer.aisec.cpg.IntegrationTest.testForeignFunctionInterface(IntegrationTest.kt:105)
	at java.base@21.0.6/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base@21.0.6/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base@21.0.6/java.util.ArrayList.forEach(ArrayList.java:1596)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Comment thread cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/LanguageInterface.kt Outdated
Comment thread cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/ScopeManager.kt
import de.fraunhofer.aisec.cpg.graph.scopes.Symbol
import de.fraunhofer.aisec.cpg.graph.types.Type

class CToCxxMapper : LanguageInterface<CLanguage, CPPLanguage>(CLanguage(), CPPLanguage()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is complete overkill. The original idea is a great idea but what you are trying to achieve can be solved by a simple adjustment of the language check (see original issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants