< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java

Print this page


   1 /*
   2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 421                 }
 422             } catch (Throwable t) {
 423                 log.error(Errors.ProcServiceProblem);
 424                 throw new Abort(t);
 425             }
 426         }
 427 
 428         ServiceIterator(ServiceLoader<Processor> loader, Log log) {
 429             this.log = log;
 430             this.loader = loader;
 431             this.iterator = loader.iterator();
 432         }
 433 
 434         @Override
 435         public boolean hasNext() {
 436             try {
 437                 return internalHasNext();
 438             } catch(ServiceConfigurationError sce) {
 439                 log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
 440                 throw new Abort(sce);






 441             } catch (Throwable t) {

 442                 throw new Abort(t);
 443             }
 444         }
 445 
 446         boolean internalHasNext() {
 447             return iterator.hasNext();
 448         }
 449 
 450         @Override
 451         public Processor next() {
 452             try {
 453                 return internalNext();
 454             } catch (ServiceConfigurationError sce) {
 455                 log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
 456                 throw new Abort(sce);
 457             } catch (Throwable t) {

 458                 throw new Abort(t);
 459             }
 460         }
 461 
 462         Processor internalNext() {
 463             return iterator.next();
 464         }
 465 
 466         @Override
 467         public void remove() {
 468             throw new UnsupportedOperationException();
 469         }
 470 
 471         public void close() {
 472             if (loader != null) {
 473                 try {
 474                     loader.reload();
 475                 } catch(Exception e) {
 476                     // Ignore problems during a call to reload.
 477                 }


   1 /*
   2  * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 421                 }
 422             } catch (Throwable t) {
 423                 log.error(Errors.ProcServiceProblem);
 424                 throw new Abort(t);
 425             }
 426         }
 427 
 428         ServiceIterator(ServiceLoader<Processor> loader, Log log) {
 429             this.log = log;
 430             this.loader = loader;
 431             this.iterator = loader.iterator();
 432         }
 433 
 434         @Override
 435         public boolean hasNext() {
 436             try {
 437                 return internalHasNext();
 438             } catch(ServiceConfigurationError sce) {
 439                 log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
 440                 throw new Abort(sce);
 441             } catch (UnsupportedClassVersionError ucve) {
 442                 log.error(Errors.ProcCantLoadClass(ucve.getLocalizedMessage()));
 443                 throw new Abort(ucve);
 444             } catch (ClassFormatError cfe) {
 445                 log.error(Errors.ProcCantLoadClass(cfe.getLocalizedMessage()));
 446                 throw new Abort(cfe);
 447             } catch (Throwable t) {
 448                 log.error(Errors.ProcBadConfigFile(t.getLocalizedMessage()));
 449                 throw new Abort(t);
 450             }
 451         }
 452 
 453         boolean internalHasNext() {
 454             return iterator.hasNext();
 455         }
 456 
 457         @Override
 458         public Processor next() {
 459             try {
 460                 return internalNext();
 461             } catch (ServiceConfigurationError sce) {
 462                 log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
 463                 throw new Abort(sce);
 464             } catch (Throwable t) {
 465                 log.error(Errors.ProcBadConfigFile(t.getLocalizedMessage()));
 466                 throw new Abort(t);
 467             }
 468         }
 469 
 470         Processor internalNext() {
 471             return iterator.next();
 472         }
 473 
 474         @Override
 475         public void remove() {
 476             throw new UnsupportedOperationException();
 477         }
 478 
 479         public void close() {
 480             if (loader != null) {
 481                 try {
 482                     loader.reload();
 483                 } catch(Exception e) {
 484                     // Ignore problems during a call to reload.
 485                 }


< prev index next >