Skip to content

Commit

Permalink
Fixes after merger
Browse files Browse the repository at this point in the history
  • Loading branch information
biboudis committed Jun 13, 2023
1 parent 4d9202c commit b0f73c1
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
* Warning: This class is part of PreviewFeature.Feature.STRING_TEMPLATES.
* Do not rely on its availability.
*/
final class Carriers {
public final class Carriers {
/**
* Maximum number of components in a carrier (based on the maximum
* number of args to a constructor.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,11 @@ protected void reset() {
}

protected Name toName() {
return sigbuf.toName(names);
try {
return sigbuf.toName(names);
} catch (InvalidUtfException e) {
throw new AssertionError(e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public <R, P> R accept(ElementVisitor<R, P> v, P p) {
methodHandlesType = enterClass("java.lang.invoke.MethodHandles");
methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
methodTypeType = enterClass("java.lang.invoke.MethodType");
carriersType = enterClass("java.lang.template.Carriers");
carriersType = enterClass("java.lang.runtime.Carriers");

errorType = enterClass("java.lang.Error");
illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,9 @@ private UnrolledRecordPattern unrollRecordPattern(JCRecordPattern recordPattern)
index++;

Type componentType = types.erasure(nestedFullComponentTypes.head);
JCPattern nestedPattern = TreeInfo.skipParens(nestedPatterns.head);
JCBindingPattern nestedBinding;
boolean allowNull;
if (nestedPattern instanceof JCRecordPattern nestedRecordPattern) {
if (nestedPatterns.head instanceof JCRecordPattern nestedRecordPattern) {
UnrolledRecordPattern nestedDesugared = unrollRecordPattern(nestedRecordPattern);
JCExpression newGuard = nestedDesugared.newGuard();
if (newGuard != null) {
Expand All @@ -357,7 +356,7 @@ private UnrolledRecordPattern unrollRecordPattern(JCRecordPattern recordPattern)
nestedBinding = nestedDesugared.primaryPattern();
allowNull = false;
} else {
nestedBinding = (JCBindingPattern) nestedPattern;
nestedBinding = (JCBindingPattern) nestedPatterns.head;
allowNull = types.isSubtype(componentType,
types.boxedTypeOrType(types.erasure(nestedBinding.type)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ int writeMatcherAttribute(MethodSymbol m) {
int acountIdx = beginAttrs();
int acount = 0;

if (m.isMatcher() && target.hasMethodParameters() && (options.isSet(PARAMETERS))) {
acount += writeMethodParametersAttr(m);
if (m.isMatcher() && target.hasMethodParameters()) {
acount += writeMethodParametersAttr(m, requiresParamNames(m));
}

acount += writeMemberAttrs(m, false, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,9 @@ public Void visitPermittedSubclasses(PermittedSubclasses_attribute attr, T p) {
public Void visitRecord(Record_attribute attr, T p) {
return null;
}

@Override
public Void visitMatcher(Matcher_attribute attr, T p) { return null; }
}

private static final Attribute.Visitor<Void, ExpectedTypeAnnotation> typeAnnoMatcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class AttributeVisitor<R, P> implements Attribute.Visitor<R, P> {
public R visitLineNumberTable(LineNumberTable_attribute attr, P p) { return null; }
public R visitLocalVariableTable(LocalVariableTable_attribute attr, P p) { return null; }
public R visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, P p) { return null; }
public R visitMatcher(Matcher_attribute attr, P p) { return null; }
public R visitNestHost(NestHost_attribute attr, P p) { return null; }
public R visitMethodParameters(MethodParameters_attribute attr, P p) { return null; }
public R visitModule(Module_attribute attr, P p) { return null; }
Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/patterns/Point.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.invoke.MethodType;
import java.lang.template.Carriers;
import java.util.Objects;

public record Point(Integer x, Integer y) {
Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/patterns/Points.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.invoke.MethodType;
import java.lang.template.Carriers;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
Expand Down

0 comments on commit b0f73c1

Please sign in to comment.