From 0657eed703ca665ad2947b136a6ada9304359006 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 31 Oct 2024 11:44:59 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 691882071 --- .../java/com/google/protobuf/Descriptors.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/java/core/src/main/java/com/google/protobuf/Descriptors.java b/java/core/src/main/java/com/google/protobuf/Descriptors.java index dc5e45a9f09e9..cffb18151dc7e 100644 --- a/java/core/src/main/java/com/google/protobuf/Descriptors.java +++ b/java/core/src/main/java/com/google/protobuf/Descriptors.java @@ -2180,9 +2180,9 @@ public FileDescriptor getFile() { * present in all runtimes; as of writing, we know that: * * * *

Care should be taken when using this function to respect the target runtime's enum @@ -2890,7 +2890,7 @@ void resolveFeatures(FeatureSet unresolvedFeatures) throws DescriptorValidationE this, "Failed to parse features with Java feature extension registry.", e); } } - + FeatureSet.Builder features; if (this.parent == null) { Edition edition = getFile().getEdition(); @@ -2922,6 +2922,13 @@ FeatureSet getFeatures() { || getFile().getEdition() == Edition.EDITION_PROTO3)) { getFile().resolveAllFeaturesImmutable(); } + if (this.features == null) { + throw new NullPointerException( + String.format( + "Features not yet loaded for %s. This may be caused by a known issue for proto2" + + " dependency descriptors obtained from proto1 (b/362326130)", + getFullName())); + } return this.features; }