0

我一直在尝试使用 Square 的 Redacted 注释从我的自动生成的类中的 toString() 方法中编辑 pin,但没有应用扩展。类加载器似乎没有读取扩展名。

@AutoValue 注释工作正常,但未应用 @Redacted 注释。

package io.*******.********.order.pin.hsm;

import com.google.auto.value.AutoValue;
import io.*****.crypto.model.PinBlockFormat;

@AutoValue
public abstract class GeneratePvvRequest {

   /** @return Hexadecimal string representing the encrypted PIN */
   @Redacted
   public abstract String pinBlock();

   /** @return Account number under which the PIN block is currently encrypted */
   public abstract String pinBlockAccountNumber();

   /** @return Name of the ZPK under which the PIN block is currently encrypted */
   public abstract String zpkName();

   /** @return Index of the ZPK under which the PIN block is currently encrypted */
   public abstract Integer zpkIndex();

   /** @return ISO format under which the PIN block is currently encrypted */
   public abstract PinBlockFormat pinBlockFormat();

   /** @return Account number used to generate the pin's PVV */
   public abstract String pvvAccountNumber();

   public static GeneratePvvRequest create(
         String pinBlock,
         String pinBlockAccountNumber,
         String zpkName,
         Integer zpkIndex,
         PinBlockFormat pinBlockFormat,
         String pvvAccountNumber) {
      return new AutoValue_GeneratePvvRequest(
            pinBlock,
            pinBlockAccountNumber,
            zpkName,
            zpkIndex,
            pinBlockFormat,
            pvvAccountNumber);
   }
}
4

1 回答 1

0

我发现了我的问题。我需要向 maven-compiler-plugin 添加一个 annotationProcessorPath。

      <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
      <annotationProcessorPaths>
        <!-- Allow Dagger to generate its boilerplate -->
        <path>
          <groupId>com.google.dagger</groupId>
          <artifactId>dagger-compiler</artifactId>
          <version>${electrum.dependency.dagger.version}</version>
        </path>
        <!-- The below wasn't strictly required, but adding any entries under annotationProcessorPaths -->
        <!-- overrides the default path which included the necessary annotation processor for auto-value -->
        <path>
          <groupId>com.google.auto.value</groupId>
          <artifactId>auto-value</artifactId>
          <version>${electrum.dependency.auto-value.version}</version>
        </path>
        <path>
          <groupId>com.squareup.auto.value</groupId>
          <artifactId>auto-value-redacted</artifactId>
          <version>1.1.1</version>
        </path>
      </annotationProcessorPaths>
    </configuration>
  </plugin>

现在一切正常。

于 2019-12-11T09:30:18.617 回答