为什么我的AutoValueExtension注释不起作用?

问题描述 投票:0回答:1

我一直在尝试使用Square的Redacted注释从我自动生成的类中的toString()方法中删除一个引脚,但是未应用扩展名。似乎扩展未由类加载器读取。

@ 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);
   }
}
annotations masking auto-value
1个回答
0
投票

我发现了我的问题。我需要在maven-compiler-plugin中添加一个commentProcessorPath。

      <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>

现在一切都正常了。

© www.soinside.com 2019 - 2024. All rights reserved.