From 243db689afd11513e45346f7077571cf1058f55c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Sun, 20 Sep 2020 16:53:31 +0200 Subject: [PATCH] Build: fix "unknown enum constant" warning on Nls.Capitalization #KTI-88 Fixed --- .../src/org/jetbrains/annotations/Nls.java | 24 +++++++++++++++++++ libraries/reflect/build.gradle.kts | 1 + 2 files changed, 25 insertions(+) create mode 100644 core/util.runtime/src/org/jetbrains/annotations/Nls.java diff --git a/core/util.runtime/src/org/jetbrains/annotations/Nls.java b/core/util.runtime/src/org/jetbrains/annotations/Nls.java new file mode 100644 index 00000000000..d4e4b21db11 --- /dev/null +++ b/core/util.runtime/src/org/jetbrains/annotations/Nls.java @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.annotations; + +import java.lang.annotation.*; + +/** + * This is a copy of `org.jetbrains.annotations.Nls` from IntelliJ. It's need in the build because Kotlin depends on annotations-13.0, + * an older version where Nls doesn't have `capitalization`, whereas new versions of the IntelliJ platform reference it in the bytecode. + * Since we intentionally remove the newer annotations artifact from the intellij-core dependency and use version 13.0 in the build, + * javac wouldn't find the class file Nls$Capitalization referenced in the bytecode, and would report a non-suppressible warning + * for each usage site of it in IntelliJ binaries. + */ +@Documented +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE, ElementType.PACKAGE}) +public @interface Nls { + Capitalization capitalization() default Capitalization.NotSpecified; + + enum Capitalization { NotSpecified, Title, Sentence } +} diff --git a/libraries/reflect/build.gradle.kts b/libraries/reflect/build.gradle.kts index 70ad3b8ee3d..edb4652eae9 100644 --- a/libraries/reflect/build.gradle.kts +++ b/libraries/reflect/build.gradle.kts @@ -109,6 +109,7 @@ val reflectShadowJar by task { configurations = listOf(embedded) exclude("**/*.proto") + exclude("org/jetbrains/annotations/Nls*.class") if (kotlinBuildProperties.relocation) { mergeServiceFiles()