-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Javanot securityThis issue does not relate to a security queryThis issue does not relate to a security queryquestionFurther information is requestedFurther information is requested
Description
There are two predicates for matching CompilationUnit to corresponding Module, Module.getACompilationUnit() and CompilationUnit.getModule() (both using the database predicate cumodule(@file, @module)).
The issue is that the reported compilation units appear to always be the .class files instead of the source .java files, even when the module-info.java file was part of the source.
For example the following query against OpenJDK has no results:
import java
from Module m, RefType t
where
t.fromSource()
and t.getCompilationUnit().getModule() = m
select m, tHowever, if you manually try to match .class compilation units with .java compilation units, you will get the desired results:
import java
predicate areProbablySame(CompilationUnit classComp, CompilationUnit sourceComp) {
classComp.getPackage() = sourceComp.getPackage()
and classComp.getName() = sourceComp.getName()
}
from Module m, TopLevelType t, CompilationUnit classComp, CompilationUnit sourceComp
where
t.fromSource()
and sourceComp = t.getCompilationUnit()
and classComp = m.getACompilationUnit()
and areProbablySame(classComp, sourceComp)
select m, t, classComp.getRelativePath(), sourceComp.getRelativePath()Metadata
Metadata
Assignees
Labels
Javanot securityThis issue does not relate to a security queryThis issue does not relate to a security queryquestionFurther information is requestedFurther information is requested