2

给定以下代码:

enum Functions
{
  background,clear,colorMode,fill,noFill,noStroke,stroke,applyMatrix,popMatrix,
  printMatrix,pushMatrix,resetMatrix,rotate,rotateX,rotateY,rotateZ,scale,shearX,shearY,
  translate,ellipseMode,smooth,noSmooth,rectMode,strokeCap,strokeJoin,strokeWeight,arc,ellipse,
  line,point,quad,rect,triangle,size,frameRate;
}

switch(Functions.valueOf(f))
{  
   case background:
     //background()
     background(random(255),random(255),random(255));
     break;
   case clear:
     //clear()
     break;
   case colorMode:
     //colorMode()
     break;
   case fill:
     //fill()
     fill(random(255),random(255),random(255));
     break;
   case size:
     //size()
     break;
   .....
}

这在大多数情况下运行良好,并且没有其他 Enum const 抛出此错误:

IllegalArgumentException: No enum const class Functions.size

但是由于某种原因,Functions.size 有时会导致抛出这个错误。有谁知道为什么这可能会间歇性发生?

4

0 回答 0