Skip to content

Commit

Permalink
Resolving default annotations (#41)
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu authored Dec 19, 2023
1 parent 56d08b2 commit 54d4fa5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "chen"
ThisBuild / organization := "io.appthreat"
ThisBuild / version := "1.0.8"
ThisBuild / version := "1.0.9"
ThisBuild / scalaVersion := "3.3.1"

val cpgVersion = "1.4.22"
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"downloadUrl": "https://github.com/AppThreat/chen",
"issueTracker": "https://github.com/AppThreat/chen/issues",
"name": "chen",
"version": "1.0.8",
"version": "1.0.9",
"description": "Code Hierarchy Exploration Net (chen) is an advanced exploration toolkit for your application source code and its dependency hierarchy.",
"applicationCategory": "code-analysis",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "1.0.8" %}
{% set version = "1.0.9" %}

package:
name: chen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -980,11 +980,22 @@ class AstCreator(
resolvedTypeOption.orElse(exprNameFromStack(expr))

private def astForAnnotationExpr(annotationExpr: AnnotationExpr): Ast =
val fallbackType = s"${Defines.UnresolvedNamespace}.${annotationExpr.getNameAsString}"
val fullName = expressionReturnTypeFullName(annotationExpr).getOrElse(fallbackType)
val code = annotationExpr.toString
val name = annotationExpr.getName.getIdentifier
val node = annotationNode(annotationExpr, code, name, fullName)
val fallbackType = annotationExpr.getNameAsString match
case x
if Seq(
"Override",
"Deprecated",
"SuppressWarnings",
"SafeVarargs",
"FunctionalInterface",
"Native"
).contains(x) => s"java.lang.$x"
case y if y.startsWith("java.") => y
case _ => s"${Defines.UnresolvedNamespace}.${annotationExpr.getNameAsString}"
val fullName = expressionReturnTypeFullName(annotationExpr).getOrElse(fallbackType)
val code = annotationExpr.toString
val name = annotationExpr.getName.getIdentifier
val node = annotationNode(annotationExpr, code, name, fullName)
annotationExpr match
case _: MarkerAnnotationExpr =>
annotationAst(node, List.empty)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "appthreat-chen"
version = "1.0.8"
version = "1.0.9"
description = "Code Hierarchy Exploration Net (chen)"
authors = ["Team AppThreat <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 54d4fa5

Please sign in to comment.