{"record":{"id":"a52c9e425e392d00","repo":"apache/iceberg","slug":"org-apache-iceberg-arrow-vectorized-arrowvectoracc","errorCode":null,"errorMessage":"org.apache.iceberg.arrow.vectorized.ArrowVectorAccessors cannot be instantiated.","messagePattern":"org\\.apache\\.iceberg\\.arrow\\.vectorized\\.ArrowVectorAccessors cannot be instantiated\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowVectorAccessors.java","lineNumber":49,"sourceCode":"  private static final GenericArrowVectorAccessorFactory<?, String, ?, ?> FACTORY;\n\n  static {\n    FACTORY =\n        new GenericArrowVectorAccessorFactory<>(\n            JavaDecimalFactory::new,\n            JavaStringFactory::new,\n            throwingSupplier(\"Struct type is not supported\"),\n            throwingSupplier(\"List type is not supported\"));\n  }\n\n  private static <T> Supplier<T> throwingSupplier(String message) {\n    return () -> {\n      throw new UnsupportedOperationException(message);\n    };\n  }\n\n  private ArrowVectorAccessors() {\n    throw new UnsupportedOperationException(\n        ArrowVectorAccessors.class.getName() + \" cannot be instantiated.\");\n  }\n\n  static ArrowVectorAccessor<?, String, ?, ?> getVectorAccessor(VectorHolder holder) {\n    return FACTORY.getVectorAccessor(holder);\n  }\n\n  private static final class JavaStringFactory implements StringFactory<String> {\n    @Override\n    public Class<String> getGenericClass() {\n      return String.class;\n    }\n\n    @Override\n    public String ofRow(VarCharVector vector, int rowId) {\n      return ofBytes(vector.get(rowId));\n    }\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowVectorAccessors.java#L31-L67","documentation":"ArrowVectorAccessors is a static-utility holder (its constructor is private and intentionally throws). Any attempt to instantiate it via reflection or new reaches this guard. This is an anti-instantiation idiom protecting a class that only exposes static factory methods like getVectorAccessor.","triggerScenarios":"Calling new ArrowVectorAccessors() (blocked at compile time, so realistically via reflection, serialization frameworks, or code generators), or frameworks that force instantiation of classes found by classpath scanning.","commonSituations":"Reflection-based utilities (e.g. Class.newInstance in old serialization or DI frameworks) touching the class; accidentally treating the utility class as a bean.","solutions":["Use the static methods (ArrowVectorAccessors.getVectorAccessor(holder)) instead of instantiating the class","Exclude utility classes from reflection-based instantiation/scanning","Mark the class final/private-constructor usage correctly in framework configs"],"exampleFix":"// before\nArrowVectorAccessors accessors = ctor.newInstance(); // throws\n// after\nArrowVectorAccessor<?, String, ?, ?> a = ArrowVectorAccessors.getVectorAccessor(holder);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"boolean isUtilityClass(Class<?> c) { try { c.getDeclaredConstructor(); return c.getDeclaredConstructor().canAccess(null) == false; } catch (NoSuchMethodException e) { return true; } }","tryCatchPattern":"try { ctor.setAccessible(true); ctor.newInstance(); } catch (InvocationTargetException e) { /* use static methods instead */ }","preventionTips":["Call static utility methods directly; never instantiate holder classes","Exclude *Accessors utility classes from classpath scanners and DI bean discovery","Avoid reflective instantiation of framework-internal classes"],"tags":["utility-class","instantiation","reflection"],"backgroundTag":"invalid-constructor-argument","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}