langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/OptionHelper.java
changeset 36157 fdbf6c9be2ab
parent 25874 83c19f00452c
child 40308 274367a99f98
equal deleted inserted replaced
36156:9ff93012d1e3 36157:fdbf6c9be2ab
     1 /*
     1 /*
     2  * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package com.sun.tools.javac.main;
    26 package com.sun.tools.javac.main;
    27 
    27 
       
    28 import java.nio.file.Path;
       
    29 
    28 import com.sun.tools.javac.util.Log;
    30 import com.sun.tools.javac.util.Log;
    29 import com.sun.tools.javac.util.Log.PrefixKind;
    31 import com.sun.tools.javac.util.Log.PrefixKind;
    30 import java.io.File;
       
    31 
    32 
    32 /**
    33 /**
    33  * Helper object to be used by {@link Option#process}, providing access to
    34  * Helper object to be used by {@link Option#process}, providing access to
    34  * the compilation environment.
    35  * the compilation environment.
    35  *
    36  *
    61 
    62 
    62     /** Report an error. */
    63     /** Report an error. */
    63     abstract void error(String key, Object... args);
    64     abstract void error(String key, Object... args);
    64 
    65 
    65     /** Record a file to be compiled. */
    66     /** Record a file to be compiled. */
    66     abstract void addFile(File f);
    67     abstract void addFile(Path p);
    67 
    68 
    68     /** Record the name of a class for annotation processing. */
    69     /** Record the name of a class for annotation processing. */
    69     abstract void addClassName(String s);
    70     abstract void addClassName(String s);
    70 
    71 
    71     /** An implementation of OptionHelper that mostly throws exceptions. */
    72     /** An implementation of OptionHelper that mostly throws exceptions. */
   110         void error(String key, Object... args) {
   111         void error(String key, Object... args) {
   111             throw new IllegalArgumentException(log.localize(PrefixKind.JAVAC, key, args));
   112             throw new IllegalArgumentException(log.localize(PrefixKind.JAVAC, key, args));
   112         }
   113         }
   113 
   114 
   114         @Override
   115         @Override
   115         public void addFile(File f) {
   116         public void addFile(Path p) {
   116             throw new IllegalArgumentException(f.getPath());
   117             throw new IllegalArgumentException(p.toString());
   117         }
   118         }
   118 
   119 
   119         @Override
   120         @Override
   120         public void addClassName(String s) {
   121         public void addClassName(String s) {
   121             throw new IllegalArgumentException(s);
   122             throw new IllegalArgumentException(s);