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

javac got a NPE at com.sun.tools.javac.code.Scope.enter(Scope.java:214)

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :


      Information: java: An exception error occurred in the compiler (1.8.0_251). If the bug is not found in the Bug Database (http://bugs.java.com), please create the Java compiler bug through the Java Bug report page (http://bugreport.java.com). Please attach your procedure and the following diagnostic information to the report. Thank you.
      Information:java: java.lang.NullPointerException
      Information:java: at com.sun.tools.javac.code.Scope.enter(Scope.java:214)
      Information:java: at com.sun.tools.javac.code.Scope.enter(Scope.java:202)
      Information:java: at com.sun.tools.javac.code.Scope.enter(Scope.java:198)
      Information:java: at com.sun.tools.javac.comp.Attr.addVars(Attr.java:1290)
      Information:java: at com.sun.tools.javac.comp.Attr.visitSwitch(Attr.java:1274)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1087)
      Information:java: at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
      Information:java: at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
      Information:java: at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:661)
      Information:java: at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2401)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
      Information:java: at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:387)
      Information:java: at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:280)
      Information:java: at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:246)
      Information:java: at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:233)
      Information:java: at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1008)
      Information:java: at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:835)
      Information:java: at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:735)
      Information:java: at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:844)
      Information:java: at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:162)
      Information:java: at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:567)
      Information:java: at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1446)
      Information:java: at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1633)
      Information:java: at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1704)
      Information:java: at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1677)
      Information:java: at com.sun.tools.javac.comp.Resolve$9.doLookup(Resolve.java:2436)
      Information:java: at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3097)
      Information:java: at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3348)
      Information:java: at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2433)
      Information:java: at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2427)
      Information:java: at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3396)
      Information:java: at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3278)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
      Information:java: at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1825)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
      Information:java: at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:625)
      Information:java: at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1593)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
      Information:java: at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1124)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      Information:java: at com.sun.tools.javac.comp.Attr.visitForLoop(Attr.java:1152)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCForLoop.accept(JCTree.java:1000)
      Information:java: at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1013)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      Information:java: at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4364)
      Information:java: at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4272)
      Information:java: at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
      Information:java: at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4176)
      Information:java: at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
      Information:java: at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
      Information:java: at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
      Information:java: at com.sun.tools.javac.main.Main.compile(Main.java:523)
      Information:java: at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
      Information:java: at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
      Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:198)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:453)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:317)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:244)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:202)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1314)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:991)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1063)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:954)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:787)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)
      Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:308)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:137)
      Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:235)
      Information:java: at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
      Information:java: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      Information:java: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      Information:java: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      Information:java: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      Information:java: at java.lang.Thread.run(Thread.java:748)
      Information:java: Errors occurred while compiling module 'FksdTest'
      Information:javac 1.8.0_251 was used to compile java sources
      Information:2020/4/27 9:52 - Compilation completed with 1 error and 0 warnings in 6 s 569 ms
      Error:java: Compilation failed: internal java compiler error

      A DESCRIPTION OF THE PROBLEM :
      I got an error when compiling a java file

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      unknown

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      unknown
      ACTUAL -
      unknown

      ---------- BEGIN SOURCE ----------
      /**
       * This java file cannot be compiled ,I tried to compile the file with javac directly on the command line, but it prompts an error, and it is useless to change the latest version of jdk
       */

      import com.alibaba.fastjson.JSON;
      import com.alibaba.fastjson.JSONObject;
      import com.pingjiae.test.PJYEnum.PJYV2Enum;
      import com.pingjiae.test.util.HttpUtil;
      import com.pingjiae.test.util.JdbcUtil;
      import lombok.Data;
      import org.apache.http.NameValuePair;
      import org.testng.Reporter;

      import java.util.ArrayList;
      import java.util.List;
      import java.util.concurrent.LinkedBlockingQueue;
      import java.util.concurrent.ThreadPoolExecutor;
      import java.util.concurrent.TimeUnit;

      @Data
      public class TestRebatestV2 {
          private static JSONObject headers = new JSONObject();
          private String username;
          private String password;
          private String webUrl;
          private String dataUrl;
          {
              headers.put("User-Agent",PJYV2Enum.USERAGENT.getVal());
          }

          private void setContentType(String contentType){
              headers.put("Content-Type",contentType);
          }
          
          public String testLogin(String username,String password){
              String api = "/api/Buyer/v1/buyerlogin";
              setContentType("application/json;charset=UTF-8");

              JSONObject params = new JSONObject();
              params.put("email",username);
              params.put("password",password);

              try {
                  JSONObject jsonObject = HttpUtil.sendPost(getWebUrl() + api, params, headers);
                  JSONObject resultJson = JSON.parseObject(jsonObject.getString("result"));
                  JSONObject data = resultJson.getJSONObject("Data");
                  String token = data.getString("Token");
                  headers.put("User-Agent",PJYV2Enum.USERAGENT.getVal());
                  headers.put("token",token);
                  return token;
              } catch (Exception e) {
                  e.printStackTrace();
              }
              return "";
          }
          
          public void testRegister(){
              int siteId = 1;
              String api = "/api/Buyer/v1/buyerregister";
              JSONObject params = new JSONObject();
              params.put("siteId", siteId);
              params.put("inviteCode", "");
              params.put("linkId", 0);
              params.put("email", username);
              params.put("password", password);
              setContentType("application/json;charset=utf-8");
              try {
                  JSONObject jsonObject = HttpUtil.sendPost(getWebUrl() + api, params, headers);
                  System.out.println(jsonObject.getString("result"));
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }

          public void rebatestBuyerRegister(int siteId){
              String api = "/api/Buyer/v1/buyerregister";
              setContentType("application/json;charset=utf-8");
              JSONObject params = new JSONObject();
              params.put("siteId", siteId);
              params.put("inviteCode", "");
              params.put("linkId", 0);
              params.put("email", username);
              params.put("password", password);

              sendConcurrentRequest(10,api,params,headers,"post");
          }

          public void rebatestApply(int promoteType,String sellerUser,Integer buyCount){
              String api = "/api/Order/v1/Applyorder";

      // String sellerUserName = "17688872576";
      // int promoteType = 1;
              setContentType("application/json;charset=utf-8");
              List<JSONObject> productIdList = JdbcUtil.getDataPrepared(PJYV2Enum.SELECT_Seller_PromoteProduct_SQL.getVal(), sellerUser,getDataUrl(), "Id");

              for (int i = 0; i < productIdList.size(); i++) {
                  JSONObject params = new JSONObject();
                  params.put("StoreProductId",productIdList.get(i).getInteger("Id"));
                  params.put("PromoteType",promoteType);
                  try {
                      JSONObject jsonObject = HttpUtil.sendGet(getWebUrl() + api, params, headers);
                      String result = jsonObject.getString("result");
                      System.out.println(result);
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
                  if (buyCount != null && i == buyCount-1) return;
              }
          }

          public void testUploadImg(String fileName,String fileNamePath){
              String api = "/api/Order/v1/uploadAmazonProject";
      // headers.put("Content-Type","multipart/form-data;boundary:----------wetjw");
              try {
                  JSONObject jsonObject = HttpUtil.sendPostMultipart(getWebUrl() + api, headers, fileName,fileNamePath);
                  String result = jsonObject.getString("result");
                  System.out.println(result);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }

          public void rebatestApplyorder(String sellerUser,int promoteType,int concurrentCount){
              String api = "/api/Order/v1/Applyorder";
              setContentType("application/json;charset=utf-8");
              List<JSONObject> productIdList = JdbcUtil.getDataPrepared(PJYV2Enum.SELECT_Seller_PromoteProduct_SQL.getVal(), sellerUser,getDataUrl(), "Id");
              JSONObject params = null;
              if (productIdList.size() == 0) return;
              for (int i = 0; i < productIdList.size(); i++) {
                  params = new JSONObject();
                  params.put("StoreProductId",productIdList.get(i).getInteger("Id"));
                  params.put("PromoteType",promoteType);
              }
              sendConcurrentRequest(concurrentCount,api,params,headers,"get");
          }

          public void rebatestOpreationAmazonOrderNum_1(){

          }

          public void rebatestDisputeAmazonOrder(){

          }

          public void rebatestUpdateamazonurl(){

          }

          public void rebatestAddrefundapply(){

          }

          public void sendConcurrentRequest(int count,String api,Object params,JSONObject headers,String requestType,String ... fileNames){
              ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(count, count, 2, TimeUnit.SECONDS, new LinkedBlockingQueue());
              for (int i = 0; i < count; i++) {
                  poolExecutor.submit(() ->{
                      JSONObject jsonObject = null;
                      switch (requestType){
                          case "get":
                              try {
                                  jsonObject = HttpUtil.sendGet(getWebUrl() + api, params, headers);
                              } catch (Exception e) {
                                  e.printStackTrace();
                              }
                              break;
                          case "post":
                              try {
                                  jsonObject = HttpUtil.sendPost(getWebUrl() + api, params, headers);
                              } catch (Exception e) {
                                  e.printStackTrace();
                              }
                              break;
                          case "postNameVluePair":
                              List<NameValuePair> paramList = (ArrayList) params;
                              jsonObject = HttpUtil.sendPostNameValuePair(getWebUrl() + api, paramList, headers);
                              break;
                          case "postMultipart":
                              if (fileNames.length == 0) return ;
                              String fileName = fileNames[0];
                              String fileNamePath = fileNames[1];
                              jsonObject = HttpUtil.sendPostMultipart(getWebUrl() + api,headers,fileName,fileNamePath);
                              break;
                      }
                      System.out.println(jsonObject.getString("result"));
                      Reporter.log("请求参数:"+params+"\n 请求结果:"+jsonObject.getString("result"));
                  });
              }
              try {
                  Thread.sleep(3000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      unknown

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: