1+ // List all non deprecated elements (types, members) that call deprecated elements
2+
3+ MATCH (annotated )- [ : ANNOTATED_BY ] -> (:Annotation )- [ : OF_TYPE ] -> (:Type { fqn : 'java.lang.Deprecated' } )
4+ OPTIONAL MATCH (artifactReadsDeprecated :Artifact )- [ : CONTAINS ] -> (typeReadsDeprecated :Type )- [ : DECLARES ] -> (readsDeprecated :Method )- [ : READS ] -> (annotated :Field )
5+ OPTIONAL MATCH (artifactInvokesDeprecated :Artifact )- [ : CONTAINS ] -> (typeInvokesDeprecated :Type )- [ : DECLARES ] -> (invokesDeprecated :Method )- [ : INVOKES ] -> (annotated :Method )
6+ OPTIONAL MATCH (artifactInvokesParameterDeprecated :Artifact )- [ : CONTAINS ] -> (typeInvokesParameterDeprecated :Type )- [ : DECLARES ] -> (invokesParameterDeprecated :Method )- [ : INVOKES ] -> (parameterAnnotatedMethod :Method )- [ : HAS ] -> (annotated :Parameter )
7+ OPTIONAL MATCH (artifactDependsOnDeprecated :Artifact )- [ : CONTAINS ] -> (typeDependsOnDeprecated :Type )- [ : DEPENDS_ON ] -> (annotated :Type )
8+ WITH coalesce (artifactReadsDeprecated , artifactInvokesDeprecated , artifactInvokesParameterDeprecated , artifactDependsOnDeprecated ) AS artifact
9+ ,coalesce (typeReadsDeprecated , typeInvokesDeprecated , typeInvokesParameterDeprecated , typeDependsOnDeprecated ) AS type
10+ ,coalesce (readsDeprecated , invokesDeprecated , invokesParameterDeprecated ) AS method
11+ ,coalesce (annotated .fqn , annotated .signature , annotated .name ) AS deprecatedElement
12+ ,CASE WHEN 'Annotation' IN labels (annotated ) THEN 'Annotation'
13+ WHEN 'Parameter' IN labels (annotated ) THEN 'Parameter'
14+ WHEN 'Field' IN labels (annotated ) THEN 'Field'
15+ WHEN 'Constructor' IN labels (annotated ) THEN 'Constructor'
16+ WHEN 'Method' IN labels (annotated ) THEN 'Method'
17+ WHEN 'Member' IN labels (annotated ) THEN 'Member'
18+ WHEN 'Class' IN labels (annotated ) THEN 'Class'
19+ WHEN 'Interface' IN labels (annotated ) THEN 'Interface'
20+ WHEN 'Enum' IN labels (annotated ) THEN 'Enum'
21+ WHEN 'Type' IN labels (annotated ) THEN 'Type'
22+ ELSE 'Unexpected'
23+ END AS deprecatedElementType
24+ ,coalesce (typeReadsDeprecated .fqn + '.' + readsDeprecated .name
25+ ,typeInvokesDeprecated .fqn + '.' + invokesDeprecated .name
26+ ,typeInvokesParameterDeprecated .fqn + '.' + invokesParameterDeprecated .name
27+ ,typeDependsOnDeprecated .fqn
28+ ) AS elementUsingDeprecatedElement
29+ WHERE artifact IS NOT NULL
30+ AND NOT (type )- [ : ANNOTATED_BY ] -> (:Annotation )- [ : OF_TYPE ] -> (:Type { fqn : 'java.lang.Deprecated' } )
31+ AND NOT (method )- [ : ANNOTATED_BY ] -> (:Annotation )- [ : OF_TYPE ] -> (:Type { fqn : 'java.lang.Deprecated' } )
32+ RETURN replace (last (split (artifact .fileName , '/' )), '.jar' , '' ) AS artifactName
33+ ,deprecatedElementType
34+ ,elementUsingDeprecatedElement
35+ ,deprecatedElement
36+ ORDER BY artifactName ASCENDING
37+ ,elementUsingDeprecatedElement ASCENDING
0 commit comments