square / wire

gRPC and protocol buffers for Android, Kotlin, Swift and Java.
https://square.github.io/wire/
Apache License 2.0
4.25k stars 570 forks source link

Nested namespaces having the same title #1976

Open uburoiubu opened 3 years ago

uburoiubu commented 3 years ago

Configuration:

wire version: 3.7.0 kotlin version: 1.5.0

Issue

This one won't compile:

syntax = "proto3";
package project.model;

message Text {
     string id = 1;
     Text text = 2;

     message Text {
         string value = 1;
     }
}

Throwing the following error:

Cause: java.lang.NullPointerException
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.awaitWithCheckCanceled(ProgressIndicatorUtils.java:346)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.awaitWithCheckCanceled(ProgressIndicatorUtils.java:339)
    at com.intellij.psi.stubs.StubIndexImpl.getAsyncState(StubIndexImpl.java:98)
    at com.intellij.psi.stubs.StubIndexImpl.getIndex(StubIndexImpl.java:369)
    at com.intellij.psi.stubs.StubIndexImpl.getContainingIds(StubIndexImpl.java:464)
    at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:298)
    at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:105)
    at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:93)
    at com.intellij.lang.properties.psi.PropertyKeyIndex.get(PropertyKeyIndex.java:48)
    at com.intellij.lang.properties.psi.impl.PropertiesFileImpl.propertiesByKey(PropertiesFileImpl.java:204)
    at com.intellij.lang.properties.psi.impl.PropertiesFileImpl.findPropertyByKey(PropertiesFileImpl.java:84)
    at com.android.build.attribution.data.StudioProvidedInfo$Companion$fromProject$1.invoke(StudioProvidedInfo.kt:38)
    at com.android.build.attribution.data.StudioProvidedInfo$Companion$fromProject$1.invoke(StudioProvidedInfo.kt:37)
    at org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt$sam$com_intellij_openapi_util_Computable$0.compute(ApplicationUtils.kt)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:881)
    at org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt.runReadAction(ApplicationUtils.kt:17)
    at com.android.build.attribution.data.StudioProvidedInfo$Companion.fromProject(StudioProvidedInfo.kt:37)
    at com.android.build.attribution.BuildAttributionManagerImpl$onBuildSuccess$1$1.invoke(BuildAttributionManagerImpl.kt:62)
    at com.android.build.attribution.BuildAttributionManagerImpl$onBuildSuccess$1$1.invoke(BuildAttributionManagerImpl.kt:58)
    at com.android.build.attribution.analytics.BuildAttributionAnalyticsManager.logBuildAttributionPerformanceStats(BuildAttributionAnalyticsManager.kt:65)
    at com.android.build.attribution.BuildAttributionManagerImpl.onBuildSuccess(BuildAttributionManagerImpl.kt:58)
    at com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutorImpl.lambda$invokeGradleTasks$2(GradleTasksExecutorImpl.java:332)
    at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.lambda$execute$0(GradleExecutionHelper.java:126)
    at org.jetbrains.plugins.gradle.GradleConnectorService$Companion.withGradleConnection(GradleConnectorService.kt:178)
    at org.jetbrains.plugins.gradle.GradleConnectorService.withGradleConnection(GradleConnectorService.kt)
    at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:112)
    at com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutorImpl.invokeGradleTasks(GradleTasksExecutorImpl.java:420)
    at com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutorImpl.run(GradleTasksExecutorImpl.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:962)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:472)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:834)

When changing this proto file to the following one, code is generated successfully.

message Text {
     string id = 1;
     TText text = 2;

     message TText {
         string value = 1;
     }
}
oldergod commented 3 years ago

It looks like protoc doesn't generate compiling code either for this one. Not sure it's worth fixing it for Wire.