Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8249003

javac failed with java.lang.NullPointerExceptionat jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1334)

XMLWordPrintable

    • x86
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      OSX Catalina 10.15.4

      A DESCRIPTION OF THE PROBLEM :
      An exception has occurred in the compiler (13.0.2). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.NullPointerException
      at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1334)

      REGRESSION : Last worked in version 13

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compiled code
      ACTUAL -
      An exception has occurred in the compiler (13.0.2). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.NullPointerException
      at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1334)

      ---------- BEGIN SOURCE ----------
      package mil.af.kr.madhatter.wingops.data.referencedata;

      import static io.restassured.module.mockmvc.RestAssuredMockMvc.mockMvc;
      import static java.util.stream.Collectors.toList;
      import static org.mockito.Mockito.when;
      import static org.springframework.http.MediaType.APPLICATION_JSON;
      import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
      import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
      import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
      import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
      import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;

      import java.io.IOException;
      import java.io.InputStream;
      import java.util.Arrays;

      import com.fasterxml.jackson.core.JsonProcessingException;
      import com.fasterxml.jackson.databind.ObjectMapper;
      import lombok.RequiredArgsConstructor;
      import lombok.extern.slf4j.Slf4j;
      import mil.af.kr.madhatter.wingops.data.referencedata.common.ConstrainedFields;
      import mil.af.kr.madhatter.wingops.data.referencedata.common.ReferenceValue;
      import mil.af.kr.madhatter.wingops.data.referencedata.data.ReferenceData;
      import mil.af.kr.madhatter.wingops.data.referencedata.enums.Branch;
      import mil.af.kr.madhatter.wingops.data.referencedata.enums.Country;
      import mil.af.kr.madhatter.wingops.data.referencedata.enums.DataType;
      import mil.af.kr.madhatter.wingops.data.referencedata.handlers.ReferenceDataHandler;
      import mil.af.kr.madhatter.wingops.data.referencedata.repository.ReferenceDataRepository;
      import org.junit.Before;
      import org.junit.Ignore;
      import org.junit.Rule;
      import org.junit.rules.TestName;
      import org.junit.runner.RunWith;
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.beans.factory.annotation.Value;
      import org.springframework.boot.test.autoconfigure.json.AutoConfigureJsonTesters;
      import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
      import org.springframework.boot.test.mock.mockito.MockBean;
      import org.springframework.core.ParameterizedTypeReference;
      import org.springframework.restdocs.JUnitRestDocumentation;
      import org.springframework.security.oauth2.jwt.JwtDecoder;
      import org.springframework.test.context.junit4.SpringRunner;
      import org.springframework.web.reactive.function.server.ServerRequest;
      import org.springframework.web.reactive.function.server.ServerResponse;
      import reactor.core.publisher.Flux;
      import wiremock.org.apache.commons.io.IOUtils;

      @Slf4j
      @RequiredArgsConstructor
      @RunWith(SpringRunner.class)
      @WebMvcTest(ReferenceDataApplication.class)
      @AutoConfigureJsonTesters
      @Ignore
      public abstract class SeverityBaseClass {
        private static final String LOCALHOST = "localhost";
        private static final int HTTP_PORT = 8080;
        private static final int SSL_PORT = 443;
        private static final String SCHEME_HTTP = "http";
        private static final String SCHEME_HTTPS = "https";

        private final ObjectMapper mapper;
        private final ReferenceDataRepository repository;
        @Rule
        public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation();
        @Rule
        public TestName testName = new TestName();
        @MockBean
        ServerResponse serverResponse;
        @MockBean
        ServerRequest serverRequest;
        @Value("${API_HOST_NAME:localhost}")
        private String host;
        @Autowired
        private ReferenceDataApplication controller;
        @Autowired
        private ObjectMapper objectMapper;
        @MockBean
        private ReferenceDataHandler mockPersistenceService;
        @MockBean
        private JwtDecoder mockJwtDecoder;

        private ReferenceData referenceData;

        @Before
        public void setup() throws IOException {
          ConstrainedFields fields = new ConstrainedFields(ReferenceData.class);

          final String dataTypes =
              serverRequest.queryParam("dataType")
                  .orElseThrow(() -> new IllegalArgumentException("dataType is required! "));

          final Country country =
              serverRequest.queryParam("country")
                  .map(Country::valueOf)
                  .orElse(Country.USA);

          final Branch branch =
              serverRequest.queryParam("branch")
                  .map(Branch::valueOf)
                  .orElse(Branch.AF);

          InputStream
              resourceAsStream =
              Thread.currentThread().getContextClassLoader()
                  .getResourceAsStream("contracts/severity.json");
          ReferenceData
              referenceData =
              objectMapper.readValue(IOUtils.toString(resourceAsStream, "UTF-8"), ReferenceData.class);
          when(mockPersistenceService.lookupDataTypes(serverRequest))
              .thenReturn(ServerResponse.ok().contentType(APPLICATION_JSON)
                  .body(
                      repository.findAllByDataTypeInAndCountryAndBranch(
                          Arrays.stream(dataTypes.split(","))
                              .map(DataType::valueOf)
                              .collect(toList()),
                          country,
                          branch
                      )
                          .groupBy(ReferenceData::getDataType, entry -> {

                            try {

                              log.info("CommonValue={}", entry.getValue());
                              return this.mapper
                                  .readValue(entry.getValue(), ReferenceValue.class);

                            } catch (final JsonProcessingException e) {
                              log
                                  .error("error parsing common data json", e);

                              throw new RuntimeException(e);
                            }

                          })
                          .log()
                          .flatMap(Flux::collectList)
                          .log(),
                      new ParameterizedTypeReference<>() {
                      }));

          mockMvc(
              standaloneSetup(controller)
                  .apply(
                      documentationConfiguration(this.restDocumentation).uris()
                          .withScheme((LOCALHOST.equals(host) ? SCHEME_HTTP : SCHEME_HTTPS))
                          .withHost(host)
                          .withPort((LOCALHOST.equals(host) ? HTTP_PORT : SSL_PORT))
                          .and().operationPreprocessors()
                          .withResponseDefaults(prettyPrint())
                  )
                  .alwaysDo(
                      document(
                          getClass().getSimpleName() + "_" + testName.getMethodName(),
                          responseFields(
                              fields.withPath("referenceData.id").description("the Record id"),
                              fields.withPath("referenceData.datatype")
                                  .description("the datatype"),
                              fields.withPath("referenceData.country")
                                  .description("the country identifier"),
                              fields.withPath("referenceData.branch").description("the service branch"),
                              fields.withPath("referenceData.value")
                                  .description("the JSON payload")
                          )
                      )
                  )
                  .build()
          );

        }

        public String authToken() {

          return AuthTokenHelper.generate();
        }

      }

      ---------- END SOURCE ----------

      FREQUENCY : always


            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: