001/* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013package org.jikesrvm.compilers.opt; 014 015/** 016 * Use this exception when the opt compiler attempts to 017 * compile an unsupported magic. 018 * We define this to be a non-fatal OptimizingCompilerException. 019 */ 020public final class MagicNotImplementedException extends OperationNotImplementedException { 021 /** Support for exception serialization */ 022 static final long serialVersionUID = -5731701797088209175L; 023 024 /** 025 * A very few magics, we have no intention of ever implementing 026 * in the opt compiler. Suppress warning messages for them 027 * to avoid confusing users with "expected" error messages 028 */ 029 public final boolean isExpected; 030 031 private MagicNotImplementedException(String s, boolean isExpected) { 032 super(s); 033 this.isExpected = isExpected; 034 } 035 036 /** 037 * Create a MagicNotImplemented exception with message <code>s</code> when we 038 * encounter a magic that we have decided to not implement in the opt 039 * compiler. 040 * @param s The message for the exception. 041 * @return the newly created exception object 042 */ 043 public static MagicNotImplementedException EXPECTED(String s) { 044 return new MagicNotImplementedException(s, true); 045 } 046 047 /** 048 * Create a MagicNotImplemented exception with message <code>s</code> when we 049 * encounter a magic that we have decided to not implement in the opt 050 * compiler. 051 * @param s The exception's message 052 * @return the newly created exception object 053 */ 054 public static MagicNotImplementedException UNEXPECTED(String s) { 055 return new MagicNotImplementedException(s, false); 056 } 057} 058 059 060